[BETA] Account Links

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment!
Suggested Hosts
Drakkim
Registered User
Posts: 176
Joined: Thu Feb 05, 2004 5:48 am

Re: [BETA] Linked Accounts

Post by Drakkim »

That is indeed beyond the scope of this mod... Mainly because I'm trying to make as few changes to the core as possible. On the other hand, thanks for bringing my attention back to the mod :-) I need to do a fresh install and check stability for another release...
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Linked Accounts

Post by Valace »

Great idea for a MOD I am other fan of yours now..perfect for my roleplay site... Just need a little help getting it working plz ;)

Any Plans for doing this for DarkFantasy theme :D Haviing alot of problems trying to fit it in? save me some work.. sorry being lazy on that part but just can not get it to work right

Any help be great, thanks
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Linked Accounts

Post by Valace »

Well I fixed the layout problem, just need to add it in right place... Used Dreamweaver to insert it correctly (yes cheated)

Now I have a big problem that when I try and access Admin Control Panel it coming up with Missing File. I realy do not want to start over again as it taken me ages to get this mod working. Any ideas?
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
Drakkim
Registered User
Posts: 176
Joined: Thu Feb 05, 2004 5:48 am

Re: [BETA] Linked Accounts

Post by Drakkim »

It's been quite a while, but I've finally updated this mod.

There've been some significant changes under the hood, so I recommend removing any old versions before upgrading. (delete old files and remove file edits from common.php and functions.php)

It is not necessary to run / change and SQL stuff or to undo / redo old template changes to upgrade.

Before installing the MCP / 'Moderate Linked Users' keep in mind that it's not complete. I the last minute in my testing, I realized that there's nothing to keep a moderator with permission to change users (required to access that module) from linking to the board Founder account and taking over the board...

Thanks all for trying this out :-)

-Drakkim
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

Thanks the updated mod appears to have sorted the problem with not being able to access ACP, this was due to the DarkFantasy Theme I was using.

I now installed like I said the new mod and edited the fuctions.php with your suggested code and I get the following error message when viewing the forum (on all themes).

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions_account_link.php on line 40: Invalid argument supplied for foreach()
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3551: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3553: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3554: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3555: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
Here how I copyed and pasted your code into my Fuctions.php:

Code: Select all

		'T_IMAGES_PATH'			=> "{$phpbb_root_path}images/",
		'T_SMILIES_PATH'		=> "{$phpbb_root_path}{$config['smilies_path']}/",
		'T_AVATAR_PATH'			=> "{$phpbb_root_path}{$config['avatar_path']}/",
		'T_AVATAR_GALLERY_PATH'	=> "{$phpbb_root_path}{$config['avatar_gallery_path']}/",
		'T_ICONS_PATH'			=> "{$phpbb_root_path}{$config['icons_path']}/",
		'T_RANKS_PATH'			=> "{$phpbb_root_path}{$config['ranks_path']}/",
		'T_UPLOAD_PATH'			=> "{$phpbb_root_path}{$config['upload_path']}/",
		'T_STYLESHEET_LINK'		=> (!$user->theme['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'],
		'T_STYLESHEET_NAME'		=> $user->theme['theme_name'],

		'SITE_LOGO_IMG'			=> $user->img('site_logo'))

	);

	// Begin Account Link Mod
	require_once($phpbb_root_path . 'includes/functions_account_link.' . $phpEx);
	account_link_form ();
	// End Account Link Mod

	// application/xhtml+xml not used because of IE
	header('Content-type: text/html; charset=UTF-8');

	header('Cache-Control: private, no-cache="set-cookie"');
	header('Expires: 0');
	header('Pragma: no-cache');

	return;
}


Please help once more :)
...and once again for the help already given me :)
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

Success!!! Works.

I moved the code to the following:

Code: Select all

  'T_IMAGES_PATH'         => "{$phpbb_root_path}images/",
      'T_SMILIES_PATH'      => "{$phpbb_root_path}{$config['smilies_path']}/",
      'T_AVATAR_PATH'         => "{$phpbb_root_path}{$config['avatar_path']}/",
      'T_AVATAR_GALLERY_PATH'   => "{$phpbb_root_path}{$config['avatar_gallery_path']}/",
      'T_ICONS_PATH'         => "{$phpbb_root_path}{$config['icons_path']}/",
      'T_RANKS_PATH'         => "{$phpbb_root_path}{$config['ranks_path']}/",
      'T_UPLOAD_PATH'         => "{$phpbb_root_path}{$config['upload_path']}/",
      'T_STYLESHEET_LINK'      => (!$user->theme['theme_storedb']) ? "{$phpbb_root_path}styles/" . $user->theme['theme_path'] . '/theme/stylesheet.css' : "{$phpbb_root_path}style.$phpEx?sid=$user->session_id&id=" . $user->theme['style_id'] . '&lang=' . $user->data['user_lang'],
      'T_STYLESHEET_NAME'      => $user->theme['theme_name'],

      'SITE_LOGO_IMG'         => $user->img('site_logo'))

   );


   // application/xhtml+xml not used because of IE
   header('Content-type: text/html; charset=UTF-8');

   header('Cache-Control: private, no-cache="set-cookie"');
   header('Expires: 0');
   header('Pragma: no-cache');

   return;

   // Begin Account Link Mod
   require_once($phpbb_root_path . 'includes/functions_account_link.' . $phpEx);
   account_link_form ();
   // End Account Link Mod

}
Is there a way I can add the account Switch into the main page instead of just under UCP?
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
Drakkim
Registered User
Posts: 176
Joined: Thu Feb 05, 2004 5:48 am

Re: [BETA] Account Links

Post by Drakkim »

It looks like the problem is that there are no linked accounts... and I didn't check for that :-)

I don't have access to a system where I can test this, but it should work:

Open "includes/functions_account_link.php"
find this (Line 40):

Code: Select all

	foreach($linked_accts as $key => $value)
	{
		if ($key != $user->data['user_id'])
		{
			$s_account_link_options .= '<option value="' . $key . '">' . $value . '</option>';
		}
	}
Replace it with this:

Code: Select all

	if (count($linked_accts) > 0) {
		foreach($linked_accts as $key => $value)
		{
			if ($key != $user->data['user_id'])
			{
				$s_account_link_options .= '<option value="' . $key . '">' . $value . '</option>';
			}
		}
	}
Then move the functions.php stuff back where it was and you should be able to put the 'account switch' box on any page.
Valace wrote:Well I fixed the layout problem, just need to add it in right place... Used Dreamweaver to insert it correctly (yes cheated)
I actually used to use Dreamweaver a lot... no fault in that. :-)
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

Sorry I do not following when you say out fuction.php back

I add the changes you suggested then put edit fuction.php and add

Code: Select all

	// Begin Account Link Mod
	require_once($phpbb_root_path . 'includes/functions_account_link.' . $phpEx);
	account_link_form ();
	// End Account Link Mod
back to the way you said from the start (guess that is what you mean by "Put it back?") and I get same error message as before:

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3549: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3551: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3552: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 3553: Cannot modify header information - headers already sent by (output started at /includes/functions.php:2959)
Putting the code only appears to work one way as said in last post. Strange huh ;)
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

ok I have tryed to add this code (below) in every way possable now even tryed to use your old code and still no luck adding this to Overall_header

Code: Select all

<!-- INCLUDE account_link_form.html -->
Did not follow what you ment to well with fuction.php when you said put it back so tryed that in all sorts of way.

Any suggestons plz?
Last edited by Valace on Tue Oct 07, 2008 7:25 pm, edited 1 time in total.
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
WDaquell
Registered User
Posts: 4
Joined: Fri Jun 20, 2008 2:35 am

Re: [BETA] Account Links

Post by WDaquell »

Actually, you really only need to update the code by casting the (possibly undeclared) array to an array:

Code: Select all

      foreach((array)$linked_accts as $key => $value)
      {
         if ($key != $user->data['user_id'])
         {
            $s_account_link_options .= '<option value="' . $key . '">' . $value . '</option>';
         }
      }   
Drakkim
Registered User
Posts: 176
Joined: Thu Feb 05, 2004 5:48 am

Re: [BETA] Account Links

Post by Drakkim »

WDaquell wrote:Actually, you really only need to update the code by casting the (possibly undeclared) array to an array:
Due to an odd quirk in foreach, that's not true... if index 0 is not set, foreach will often still throw a warning, even though the variable is an array... that is actually still possible here, though, since I'm using the user_id as an index and nobody is linked to user 0 (guest account) I'll probably have to set id 0 and ignore it... But aside from that, I still need to declare that to prevent other warnings from creeping in...

Thanks :-)
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

and how do I get the drop down box to work on every page, I.E the overall_header as the following code does not appear to do anything:

Code: Select all

<!-- INCLUDE account_link_form.html -->
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
Drakkim
Registered User
Posts: 176
Joined: Thu Feb 05, 2004 5:48 am

Re: [BETA] Account Links

Post by Drakkim »

You fixed the "includes/functions_account_link.php" file and put the functions.php back the way the MOD says and still get errors?

If so, try moving the lines right BEFORE the return line

Find

Code: Select all

	// application/xhtml+xml not used because of IE
	header('Content-type: text/html; charset=UTF-8');

	header('Cache-Control: private, no-cache="set-cookie"');
	header('Expires: 0');
	header('Pragma: no-cache');
Add After

Code: Select all

	// Begin Account Link Mod
	require_once($phpbb_root_path . 'includes/functions_account_link.' . $phpEx);
	account_link_form ();
	// End Account Link Mod
If you add that AFTER return (as you said you did earlier), it doesn't get run because that's the end of the function. If it doesn't get run, the template won't have the data it needs and won't show.

Aside from all that, are the error messages there the very first thing on the page and the only [phpBB Debug] messages on the page?

It looks like there's another error somewhere because the "(output started at /includes/functions.php:2959)" is right in the middle of the error handler code.

Let me know your site (in topic or PM) and I'll take a look at it for myself :-)

-Drakkim
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

I have PM you my forum details so you can access further in.

Yes the error message appears on the first page and changing the template around also. This message also appears on all other templates I try so I know its not related to using Dark Fantasy Theme like I thought at first.

Also adding this code (below) appears to be the only thing making the problem. I can Switch User fine if I go via UCP way. It just when I add the code so I can switch on the main page

Code: Select all

   // Begin Account Link Mod
   require_once($phpbb_root_path . 'includes/functions_account_link.' . $phpEx);
   account_link_form ();
   // End Account Link Mod
Once again thanks a million times for your help


New Error Message on front page

Code: Select all

phpBB Debug] PHP Notice: in file /includes/functions_account_link.php on line 41: Invalid argument supplied for foreach()
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc
User avatar
Valace
Registered User
Posts: 177
Joined: Sat Sep 20, 2008 9:40 pm

Re: [BETA] Account Links

Post by Valace »

Ahh huh I feel like I am starting to get some where now.

I started over again and followed your MOD word by word and placed every code where you said but I added a new code that WDaquell suggested:
WDaquell wrote:Actually, you really only need to update the code by casting the (possibly undeclared) array to an array:

Code: Select all

 foreach((array)$linked_accts as $key => $value)
{
if ($key != $user->data['user_id'])
{
$s_account_link_options .= '<option value="' . $key . '">' . $value . '</option>';
}
} 
This has removed all error messages totaly and the template/skin appears fine now.

However the Switch User only works if I click on UCP and hit Switch User that way, if I press switch user on the main pages, inserting the:

Code: Select all

	<!-- INCLUDE account_link_form.html -->
It only refreshs the page.

It appears I am almost there now, the only problem now is the refresh page issue on Overall_header page
Image - Help look after the Earth and get green hosting
Free Domain: http://www.co.cc

Return to “[3.0.x] MODs in Development”