The Arcive of vBulletin Modifications Site. |
|
Using welcome variables in header Details »»
|
|||||||||||||||||||||||||
Hi,
How can I use the welcome panel variables such as $welcometext in my header template? I would like the user information when logged in to appear on all the VB pages. Thank You, Pawel Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
||||
|
||||
|
instead of inserting the welcomepanel code into index.php you have to insert it into global.php before $header is parsed.
but you shouldn'T do that, as it would increase every page's queries |
|
#3
|
|||
|
|||
|
Hi,
I put in all the variables into global.php but it still won't work. Here is what I put at the bottom of global.php: Code:
//check usergroup of user to see if they can use PMs
//$permissions=getpermissions($forumid);
if ($enablepms==1 and $permissions['canusepm'] and $bbuserinfo['receivepm']) {
$ignoreusers="";
if (trim($bbuserinfo['ignorelist'])!="") {
$ignoreusers='AND fromuserid<>'.implode(' AND fromuserid<>',explode(' ', trim($bbuserinfo['ignorelist'])));
}
$allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
$newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
$unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");
if ($newpm['messages']==0) {
$lightbulb='off';
} else {
$lightbulb='on';
}
eval("\$pminfo = \"".gettemplate('forumhome_pmloggedin')."\";");
} else {
$pminfo='';
}
$numbersmembers=$DB_site->query_first('SELECT COUNT(*) AS users,MAX(userid) AS max FROM user');
$numbermembers=number_format($numbersmembers['users']);
// get total posts
$countposts=$DB_site->query_first('SELECT COUNT(*) AS posts FROM post');
$totalposts=number_format($countposts['posts']);
$countthreads=$DB_site->query_first('SELECT COUNT(*) AS threads FROM thread');
$totalthreads=number_format($countthreads['threads']);
// get newest member
$getnewestusers=$DB_site->query_first("SELECT userid,username FROM user WHERE userid=$numbersmembers[max]");
$newusername=$getnewestusers['username'];
$newuserid=$getnewestusers['userid'];
// if user is know, then welcome
if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];
eval("\$welcometext = \"".gettemplate('forumhome_welcometext')."\";");
eval("\$logincode = \"".gettemplate('forumhome_logoutcode')."\";");
eval("\$newposts = \"".gettemplate('forumhome_newposts')."\";");
} else {
$welcometext = "";
eval("\$newposts = \"".gettemplate('forumhome_todayposts')."\";");
eval("\$logincode = \"".gettemplate('forumhome_logincode')."\";");
}
Thank You, Paul |
|
#4
|
|||
|
|||
|
Oh and by bottom I mean above ?>
Thanks, Paul |
|
#5
|
||||
|
||||
|
reread my post again!
i said put the code before $header is parsed, not at the end of global.php |
|
#6
|
|||
|
|||
|
Sorry just woke up
, I will try it as soon as I get back home.Thank You, Paul |
|
#7
|
||||
|
||||
|
Add that code before:
PHP Code:
|
|
#8
|
|||
|
|||
|
Thanks Xenon, it worked perfectly. Assassingod I would try that but since I have it working I don't have time to mess with it, thanks for the help though.
Paul |
![]() |
|
|