View Full Version : Using Vbulletin Vars in Custom Templates?
I have been trying to create a plugin to move the login box to the top of the page. All was going well, I made two templates for the guest and member logged in states. I put the style vars in the header template with a if statement. However the problem I am running into is that I cannot use " in the custom template, it always tries to escape the characters. So I went and replaced everything with single quotes, which fixed the html code. However all the vbulletin variables dont seem to be working. I was trying to use $bbuserinfo[username] and the all the login hidden fields/javascript. This functionality seems to all be broken unless I paste the code directly to the header template.
Is there any way around this?
Dismounted
11-14-2008, 03:08 AM
$bbuserinfo is only used in templates. You usually use $vbulletin->userinfo in plugins.
One of the issues I seem to be running into is with the " not working in custom templates.
It seems the page is not properly parsed.
For instance:
<span class='navbar_text'> <strong><phrase 1='$vbulletin->userinfo[username]' 2='member.php?$session[sessionurl]u=$vbulletin->userinfo[userid]'>$vbphrase[welcome_x_link_y]</phrase></strong>
Comes out like this:
" . construct_phrase("$vbphrase[welcome_x_link_y]", "$vbulletin->userinfo[username]", "member.php?" . $GLOBALS['vbulletin']->session->vars['sessionurl'] . "u=$vbulletin->userinfo[userid]") . "
Twilkey
11-14-2008, 07:05 PM
Try
<span class="navbar_text"> <strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong>
Try
<span class="navbar_text"> <strong><phrase 1="$bbuserinfo[username]" 2="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[welcome_x_link_y]</phrase></strong>
This comes out as:
" . construct_phrase("$vbphrase[welcome_x_link_y]", "" . $GLOBALS['vbulletin']->userinfo['username'] . "", "member.php?" . $GLOBALS['vbulletin']->session->vars['sessionurl'] . "u=" . $GLOBALS['vbulletin']->userinfo['userid'] . "") . "
Lynne
11-17-2008, 10:15 PM
What template are you putting this in?
I got this fixed now, I was not doing an eval to fetch the template.
However now I am having one issue:
<phrase 1="$pmbox[lastvisitdate]" 2="$pmbox[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
Comes out as:
You last visited: at
Obviously pmbox is not available for custom templates so I tried :
<phrase 1="$vbulletin->userinfo[lastvisitdate]" 2="$vbulletin->userinfo[lastvisittime]">$vbphrase[last_visited_x_at_y]</phrase>
Which came out as:
You last visited: Array[lastvisitdate] at Array[lastvisittime]
Any ideas on what variable to use?
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.