Thanks, that worked!
Now to make it so that only logged in users can see the tab. I'm assuming $vbulletin->userinfo['userid'] returns either empty or '0' if the user isn't logged in, so an if statement should do the job (hopefully) =)
--------------- Added [DATE]1281736840[/DATE] at [TIME]1281736840[/TIME] ---------------
In case anyone is interested, here is the code to add to a new vBulletin plugin which will create a conditional navbar tab. If the user is logged in, it displays a tab linking to his profile. If not, it displays a tab linking to the registration page (register.php).
Thanks Cellarius and Lynne for helping me figure it out!
PHP Code:
$tabselected = '';
$tablinks = '';
$tabselected_nolog = '';
$tablinks_nolog = '';
if (THIS_SCRIPT == 'member')
{
$vbulletin->options['selectednavtab']='my_profile';
$tabselected = ' class="selected"';
$tablinks = ' <ul class="floatcontainer">
<li><a href="private.php">Inbox</a></li>
<li><a href="profile.php?do=editprofile">Edit Profile</a></li>
<li><a href="profile.php?do=editoptions">Account Settings</a></li>
<li><a href="profile.php?do=privacy">Privacy Settings</a></li>
</ul> ';
}
if (THIS_SCRIPT == 'register')
{
$vbulletin->options['selectednavtab']='sign_up';
$tabselected_nolog = ' class="selected"';
}
$userid = $vbulletin->userinfo['userid'];
if($userid == 0)
{
$template_hook['navtab_start'] .= '<li'.$tabselected_nolog.'><a class="navtab" href= "register.php">Sign Up</a>'.$tablinks_nolog.'</li>' ;
}else if($userid > 0){
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href= "member.php?'.$userid.'">My Profile</a>'.$tablinks.'</li>' ;
}