PDA

View Full Version : User Info in header


Auero
01-09-2003, 05:07 PM
I want to be able to put the user information into the header template.

Such info as .... Username, PM information, Time, Avatar. Is this possible??

Also having this information in the header will it work on all pages such as showthread, member etc...

Thanks.

Xenon
01-09-2003, 05:08 PM
You can just have in the header what is defined in global.php

so the complete $bbuserinfo array is useable there :)

Auero
01-09-2003, 05:21 PM
Could you just give me a short example of this please?

Auero
01-09-2003, 05:25 PM
Okay I have the Username in the header now :)

But what variables would I use to display the info in the image I've attached below.

Auero
01-09-2003, 05:32 PM
Ah okay lol I'm getting this myself now. I should try before asking for help.

I've done the username and the posts. I'm a little unsure of what to use for the time, PM info and the avatar. Any help.

Xenon
01-09-2003, 08:15 PM
well, pms are not saved this time, you have to add a query....

try to add this into your phpinclude template:$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages,
SUM(IF(dateline>$bbuserinfo[lastvisit] AND folderid=0,1,0)) AS newpm,
SUM(IF(messageread=0 AND folderid=0,1,0)) AS unreadpm
FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");

then you can use $allpm[messages] as the numer of all messages, and $allpm[newpm] as the number of new pms

avatars you have to add this into phpinclude:

if ($bbuserinfo[hascustomavatar] and $avatarenabled) {
$bbuserinfo[showavatar]="<img src=\"avatar.php?userid=$post[userid]&dateline=$post[avatardateline]\">";
} else {
$bbuserinfo[showavatar]="";
}
then use $bbuserinfo[showavatar]

it will show the custom avatar of a user :)

Auero
01-09-2003, 10:35 PM
Thank you so much Xenon this is great, it helps a lot :D

Auero
01-10-2003, 04:26 PM
Okay, I've tried the code you've given me and the Avatar part doesn't work. I can get a default unregistered avatar to show.
} else {
$bbuserinfo[showavatar]="";
} - If I put an image tag into here It will display.

Although I have a avatar set for my user It will not show.

NTLDR
01-10-2003, 05:10 PM
$bbuserinfo[showavatar]="<img src=\"avatar.php?userid=$post[userid]&dateline=$post[avatardateline]\">";

Needs to be:

$bbuserinfo[showavatar]=getavatarurl($bbuserinfo[userid]);

Note this will add another query too ;)

Auero
01-10-2003, 06:12 PM
Thanks, I couldn't wait though as it was for a client. So I got help from Mist. Thanks a lot though :D