@kh99
Thanks again for a reply
I had a look at the code you suggested and didn't really see what I hoped to see
Code:
/**
* Returns appropriate user info for the owner of this session.
*
* @return array Array of user information.
*/
function &fetch_userinfo()
{
if ($this->userinfo)
{
// we already calculated this
return $this->userinfo;
}
else if ($this->vars['userid'] AND !defined('SKIP_USERINFO'))
{
// user is logged in
$useroptions = (defined('IN_CONTROL_PANEL') ? FETCH_USERINFO_ADMIN : 0) + (defined('AVATAR_ON_NAVBAR') ? FETCH_USERINFO_AVATAR : 0);
$this->userinfo = fetch_userinfo($this->vars['userid'], $useroptions, $this->vars['languageid']);
return $this->userinfo;
}
else
{
// guest setup
$this->userinfo = array(
'userid' => 0,
'usergroupid' => 1,
'username' => (!empty($_REQUEST['username']) ? htmlspecialchars_uni($_REQUEST['username']) : ''),
'password' => '',
'email' => '',
'styleid' => $this->vars['styleid'],
'languageid' => $this->vars['languageid'],
'lastactivity' => $this->vars['lastactivity'],
'daysprune' => 0,
'timezoneoffset' => $this->registry->options['timeoffset'],
'dstonoff' => $this->registry->options['dstonoff'],
'showsignatures' => 1,
'showavatars' => 1,
'showimages' => 1,
'showusercss' => 1,
'dstauto' => 0,
'maxposts' => -1,
'startofweek' => 1,
'threadedmode' => $this->registry->options['threadedmode'],
'securitytoken' => sha1(sha1(COOKIE_SALT) . USER_AGENT)
);
I guess that's the relevant part of the fetch_userinfo() function as the rest seems to be to do with avatars, and selecting the correct phrase (languages)
Prob is here my php knowledge ain't quite good enough
function &fetch_userinfo() - what's the & for? I did do a bit of a google on this '&function' stuff but non of it seems to make much sense to me. In fact the info I found on php forms seems to say it doesn't really do anything much useful - or at least I couldn't find a sensible example.
$this->userinfo = fetch_userinfo($this->vars['userid'], $useroptions, $this->vars['languageid']);
Now the fetch_userinfo() function them seems to call
itself with some arguments (constants) here, even though fetch_userinfo() doesn't seem to be declared to have any arguments - or at least I can't see it doing anything with arguments in the code - hence the empty ()
I can see the stuff where it builds the userinfo array for a guest, thats easy enough to follow.
I was rather expecting to see some SQL here that reads various tables and builds the userinfo array if you are logged in


Your php is a lot better than mine m8 - I think I just hit the limit of my understanding so far. Help!
--------------- Added [DATE]1301768461[/DATE] at [TIME]1301768461[/TIME] ---------------
OK I have managed to do what I needed to do by adding some code to login.php to rebuild a couple of the counters in userinfo array the way I want them.
I still didn't find the SQL that initialises them on log in but what the hell it works the way I want it to now - and a couple extra SQL on login ain't gonna effect performance much
I would (for my own understanding) still like to know how the php above works though.
Rich