vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=242)
-   -   [HOW TO - vB4] Create a New Tab in the navbar (https://vborg.vbsupport.ru/showthread.php?t=226914)

Lynne 05-20-2010 03:27 AM

I don't know if it would be easier to manage. On my site, I only want to add one or two more tabs and so it's no problem for me to do it the way everything is currently set up. I find it pretty simple the way it is, so I've never looked into an 'easier' method.

Lynk 05-24-2010 09:12 PM

Now that I've gone through all of the work, I hope this helps someone on here. A while back, I created two new tabs (Home and Groups) over at http://www.drzforums.com, and just replicated the navlinks from the Forums navtab. The result was a set of broken links for visitors, since some of the navlinks require registration.

Today, I converted the navlinks conditional statements from the vB-specific HTML found in navheader, into the PHP required for a plug-in. Here is the plug-in code for my Groups tab:

PHP Code:

$tabselected '';
$tablinks '';
if (
THIS_SCRIPT == 'group')
{
    
$vbulletin->options['selectednavtab']='navtablabel_groups';
    
$tabselected ' class="selected"';
    
$tablinks '<ul class="floatcontainer">'.$template_hook['navbar_start'];

    if (
$show['searchbuttons']) {
        if (
$show['member'])
            
$tablinks .= '<li><a href="search.php?'.$session['sessionurl'].'do=getnew&amp;contenttype=vBForum_Post">'.$vbphrase['new_posts_nav'].'</a></li>';
        else
            
$tablinks .= '<li><a href="search.php?'.$session['sessionurl'].'do=getdaily&amp;contenttype=vBForum_Post">'.$vbphrase['todays_posts'].'</a></li>';
    }

    
$tablinks .= $template_hook['navbar_after_getnew'];

    if (
$show['pmmainlink'])
        
$tablinks .= '<li><a href="private.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['private_messages'].'</a></li>';

    
$tablinks .= $template_hook['navbar_after_pm'].'<li><a rel="help" href="faq.php'.$session['sessionurl_q'].'" accesskey="5">'.$vbphrase['faq'].'</a></li>'.$template_hook['navbar_after_faq'].'<li><a href="calendar.php'.$session['sessionurl_q'].'">'.$vbphrase['calendar'].'</a></li>'.$template_hook['navbar_after_calendar'].'<li class="popupmenu"><a href="javascript://" class="popupctrl" accesskey="6">'.$vbphrase['community'].'</a><ul class="popupbody popuphover">'.$template_hook['navbar_community_menu_start'];

    if (
$show['quick_links_groups'])
        
$tablinks .= '<li><a href="group.php'.$session['sessionurl_q'].'">'.$vbphrase['social_groups'].'</a></li>';

    if (
$show['quick_links_albums'])
        
$tablinks .= '<li><a href="album.php'.$session['sessionurl_q'].'">'.$vbphrase['pictures_and_albums'].'</a></li>';

    if (
$bbuserinfo['userid']) {
        
$tablinks .= '<li><a href="profile.php?'.$session['sessionurl'].'do=buddylist">';

        if (
$show['friends_and_contacts'])
            
$tablinks .= $vbphrase['contacts_and_friends'];
        else
            
$tablinks .= $vbphrase['contacts'];

        
$tablinks .= '</a></li>';
    }

    if (
$show['memberslist'])
        
$tablinks .= '<li><a href="memberlist.php'.$session['sessionurl_q'].'">'.$vbphrase['members_list'].'</a></li>';

    
$tablinks .= $template_hook['navbar_community_menu_end'].'</ul></li>'.$template_hook['navbar_after_community'].'<li class="popupmenu"><a href="javascript://" class="popupctrl">'.$vbphrase['forum_actions'].'</a><ul class="popupbody popuphover"><li><a href="forumdisplay.php?'.$session['sessionurl'].'do=markread">'.$vbphrase['mark_forums_read'].'</a></li>';

    if (
$show['member'])
        
$tablinks .= '<li><a href="profile.php?'.$session['sessionurl'].'do=editoptions">'.$vbphrase['edit_options'].'</a></li><li><a href="profile.php?'.$session['sessionurl'].'do=editprofile">'.$vbphrase['edit_your_details'].'</a></li>';

    
$tablinks .= '</ul></li><li class="popupmenu"><a href="javascript://" class="popupctrl" accesskey="3">'.$vbphrase['quick_links'].'</a><ul class="popupbody popuphover">';

    if (
$show['member']) {

        if (
$show['member'])
            
$tablinks .= '<li><a href="subscription.php'.$session['sessionurl_q'].'" rel="nofollow">'.$vbphrase['subscribed_threads'].'</a></li>';

        
$tablinks .= '<li><a href="javascript://" onclick="window.open(getBaseUrl() + \'misc.php?'.$session['sessionurl'].'do=buddylist&amp;focus=1\',\'buddylist\',\'statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300\'); return false;">'.$vbphrase['open_contacts'].'</a></li>';

        if (
$vboptions['forumleaders']) {
            
$tablinks .= '<li><a href="showgroups.php'.$session['sessionurl_q'].'" rel="nofollow">';

            if (
$vb_suite_installed)
                
$tablinks .= $vbphrase['view_site_leaders'];
            else
                
$tablinks .= $vbphrase['view_forum_leaders'];

            
$tablinks .= '</a></li>';

        }

    }

    
$tablinks .= $template_hook['navbar_quick_links_menu_pos1'].$template_hook['navbar_quick_links_menu_pos2'].$template_hook['navbar_quick_links_menu_pos3'];

    if (
$show['wollink'])
        
$tablinks .= '<li><a href="online.php'.$session['sessionurl_q'].'">'.$vbphrase['whos_online'].'</a></li>';

    
$tablinks .= $template_hook['navbar_quick_links_menu_pos4'].'</ul></li>'.$template_hook['navbar_end'].'</ul></li>';


$template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="group.php">Groups</a>'.$tablinks.'</li>' 

Enjoy! :cool:

Lionel 05-27-2010 02:16 AM

how do you check permissions at that hook?

$cando = $permissions['myproduct'] & $vbulletin->bf_ugp['myproduct']['cando'] ? true : false;

is not doing anything.

edit ... found answer in blogs

GriZzm0 05-27-2010 08:11 AM

Thanks. Using this for one of my subforums (kind of like the tabs here at vB.org). However, instead of forumdisplay.php?{vb:raw session.sessionurl}2-Main-Forum I would like to generate 2-Main-Forum using the vBulletin link generator so it takes the current rewrite rules into consideration. Any ideas how I would do that?

Hippy 06-01-2010 09:55 PM

Lynne can this be used to make a simple navtab with out the drop down and sub links in the lower navbar ?

thanks

Lynne 06-02-2010 03:48 AM

Quote:

Originally Posted by Hippy (Post 2046728)
Lynne can this be used to make a simple navtab with out the drop down and sub links in the lower navbar ?

thanks

I would guess you could leave the submenu (and thus dropdown) out of it.

Hippy 06-02-2010 08:49 PM

thanks

AfterWorldForum 06-04-2010 04:14 PM

I cannot seem to get the plugin to accept a userid in the menu. I'm probably overlooking something obvious, but here's my code:

Code:

$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .
$bbuserinfo['userid'] . '">

In the page defined in the plugin (tracker), I do have the line to include the vB stuff:

Code:

require_once('./global.php');
I tried putting an if ($bbuserinfo[userid]) block around the statement above, but that doesn't show any links. I even tried adding a $vbulletin->bbuserinfo in front of it, but again, no luck.

Any ideas what I might be doing wrong or overlooking?

Thanks :)

Lynne 06-04-2010 05:12 PM

Try

Code:

$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .$vbulletin->userinfo[userid]. '">

AfterWorldForum 06-04-2010 06:22 PM

Quote:

Originally Posted by Lynne (Post 2048308)
Try

Code:

$tablinks .= '<li><a href="tracker.php?'. $session['sessionurl'] . '&do=search&userid=' .$vbulletin->userinfo[userid]. '">

You are wise in the ways of plugins, Lynne :D Much obliged :hattip:

AliceHoward 06-06-2010 08:35 AM

Hi Lynne,

I am wondering if there is anyway for me to use this great tutorial.

I want to be able to use this even though I do not have a custom page, I have my forumhome split to keep style download forums out of my main forums. I have do this using a really old mod by amykhar.

My forums for style downloads are located on forum.php?page=2, there isn't a this script defined anywhere so I cannot use one to get the tab higlighted or the pop-up menus to appear.

This is how I have my plugin written:
Code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'forum.php?page=2')
{
    $vbulletin->options['selectednavtab']='style_forums';
    $tabselected = ' class="selected"';
    $tablinks = ' <ul class="floatcontainer">
                        <li class="popupmenu">
                            <a href="javascript://" class="popupctrl">The vB3 Styles</a>
                            <ul class="popupbody popuphover">
                                    <li><a href="forumdisplay.php?11-Download-vB3-Lighter-Styles">Download vB3 Lighter Styles</a></li>
                                    <li><a href="forumdisplay.php?16-Download-vB3-Dark-Styles">Download vB3 Dark Styles</a></li>
                                    <li><a href="project.php?projectid=2">Project vB Styles Version 3.8x</a></li>
                            </ul>
                        </li>
                        <li class="popupmenu">
                            <a href="javascript://" class="popupctrl">The vB4 Styles</a>
                            <ul class="popupbody popuphover">
                                    <li><a href="forumdisplay.php?10-Download-vB4-Styles">Download vB4 Styles</a></li>
                                    <li><a href="project.php?projectid=3">Project vB Styles Version 4</a></li>
                            </ul>
                        </li>
                        <li class="popupmenu">
                            <a href="javascript://" class="popupctrl">Loyal Member Styles</a>
                            <ul class="popupbody popuphover">
                                    <li><a href="forumdisplay.php?22-Loyal-Member-vB4-Styles">Loyal Member vB4 Styles</a></li>
                                    <li><a href="project.php?projectid=4">Project vB4 Styles Loyal Members</a></li>
                            </ul>
                        </li>
                </ul> ';

}
$template_hook['navtab_end'] .= '<li'.$tabselected.'><a class="navtab" href="forum.php?page=2">Styles Forums</a>'.$tablinks.'</li>' ;

In use here:
http://www.styleorigin.com/vbstyles/forum.php

The link navigates to the page well enough but obviously the tab doesn't higlight and the pop-up menus do not appear. I know this is because of the incorrect use of the THIS_SCRIPT, but I don't know what to use instead.

Do you have any ideas please?

Lionel 06-06-2010 09:15 AM

@Alice. Have you tried if(THIS_SCRIPT == 'index' AND $_REQUEST['page'] == 2) ?

wonderfulwat 06-06-2010 09:49 AM

1 Attachment(s)
Hi, great site! I need some help.

When I unselect "Sections to Display in the Navbar Sub-Menu" I end up losing the Home tab. Is there any way to keep the Home tab present? It remains on every other screen (ie. when I'm in the forums - screenshots attached). My site is: www.wonderfulwaterloo.com if you want to check out the error.

I imagine it has something to do with this, and I tried to play around with it but the forum stopped working.

Edit Plugin Navbar: Insert CMS Navbar Entry

Code:

if (defined('CMS_SCRIPT') AND class_exists('vBCms_Navbar'))
{
        $vbulletin->options['selectednavtab'] = 'vbcms';
        $template_hook['navtab_start'] .= vBCms_NavBar::renderView();
}
else
{
        $template_hook['navtab_start'] .= vB_Template::create('vbcms_navbar_link')->render();
        $template_hook['navbar_getnew_menu'] .= vB_Template::create('vbcms_navbar_whatsnew_link')->render();
}


AliceHoward 06-07-2010 07:00 AM

Quote:

Originally Posted by Lionel (Post 2049184)
@Alice. Have you tried if(THIS_SCRIPT == 'index' AND $_REQUEST['page'] == 2) ?

Oh you darling, that works wonderfully well, thank you ever so much sweetie. :)

Wormy! 06-29-2010 08:16 AM

Quote:

Originally Posted by Wormy! (Post 1962918)
Hmmm... how/where do I do that? Please :)

I'm trying to get the standard highlight/floating bar which shows above the tab...

Thank you!!

--------------- Added [DATE]1264124054[/DATE] at [TIME]1264124054[/TIME] ---------------

If I follow your tutorial... should that not be the case? Apologies for all the questions...

Hi Lynne

Appreciate all of your help... and I have all working bar one last thing...

When a user lands on my home page (by clicking on the new 'HOME' button I created), the highlighted button remains as the 'FORUMS' button? If they are on the home page, I would like them to see the 'HOME' button (which is the one I created with your mod) to be highlighted.

Are you able to help me work out this last aspect pls?

Cheers
Wormy

Lynne 07-01-2010 03:19 PM

If your custom tab is not getting highlighted, then you probably don't have your condition for it written correctly. As I specified, that condition MUST be unique or it won't work.

Wormy! 07-02-2010 10:06 AM

Hi Lynne

It is unique... and that's what's puzzling me 8|

It ighlights when it mouse overs... no problem there... BUT when a user clicks on the 'Home' tab and is directed there... the 'Forums' tab still remains as the highlighted option?

Does that make sense?

Thanks in advance!!

Lynne 07-02-2010 02:24 PM

What is that unique condition?

Wormy! 07-02-2010 08:30 PM

Hi Lynne

Heres my code:

Code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'home_tab')
{
    $vbulletin->options['selectednavtab']='home_tab';
    $tabselected = ' class="selected"';
    $tablinks = '                <ul class="floatcontainer">
                        <li><a href="link1.php">Link 1</a></li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Drop Down</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="sublink1.php">SubLink 1</a></li>
                                        <li><a href="sublink2.php">SubLink 2</a></li>
                                        <li><a href="sublink3.php">SubLink 3</a></li>
                                </ul>
                            </li>
                        <li><a href="link2.php">Link 2</a></li>
                        <li><a href="link3.php">Link 3</a></li>
                </ul> ';

}
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.technologyatplay.com">Home</a>'.$tablinks.'</li>' ;

Appreciate your help!

pant 07-02-2010 08:41 PM

Has anyone posted how to get the 'quick links' drop down on every page yet?

Lynne 07-03-2010 03:37 PM

Quote:

Originally Posted by Wormy! (Post 2063401)
Hi Lynne

Heres my code:

Code:

$tabselected = '';
$tablinks = '';
if (THIS_SCRIPT == 'home_tab')
{
    $vbulletin->options['selectednavtab']='home_tab';
    $tabselected = ' class="selected"';
    $tablinks = '                <ul class="floatcontainer">
                        <li><a href="link1.php">Link 1</a></li>
                            <li class="popupmenu">
                                <a href="javascript://" class="popupctrl">Drop Down</a>
                                <ul class="popupbody popuphover">
                                        <li><a href="sublink1.php">SubLink 1</a></li>
                                        <li><a href="sublink2.php">SubLink 2</a></li>
                                        <li><a href="sublink3.php">SubLink 3</a></li>
                                </ul>
                            </li>
                        <li><a href="link2.php">Link 2</a></li>
                        <li><a href="link3.php">Link 3</a></li>
                </ul> ';

}
$template_hook['navtab_start'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.technologyatplay.com">Home</a>'.$tablinks.'</li>' ;

Appreciate your help!

And you defined THIS_SCRIPT to be "home_tab" where? That is not a default definition, so you would have needed to actually go define it manually somehow. If you are trying to do the content.php page, then if you look at the top of that page, you will see that THIS_SCRIPT is defined as "vbcms", not "home_tab".

Wormy! 07-03-2010 09:41 PM

I'm going to sound slow here... but you've kind of lost me :(

I am using vBadvanced CMPS. I'm not exectly sure where I get the specific details for "THIS_SCRIPT"

I've looked in the page sourece code and I can't identify anything that looks like how the page is defined?

Sorry for my slow uptake on this... I doo aprreciate your help!

--------------- Added [DATE]1278197941[/DATE] at [TIME]1278197941[/TIME] ---------------

Bingo!! Got it!!

Doh! I edited the main index page and found the "THIS_SCRIPT" and we are off and running :)

Seriously... thanks SO much for your help!!!

--------------- Added [DATE]1278199197[/DATE] at [TIME]1278199197[/TIME] ---------------

Hi Lynne

Just a quick query... now that i have that in place, is there any way of getting the default forum settings to appear 'under' the Nav?

ie: * New Posts
* Private Messages
* FAQ
* Calendar
* Community
o Groups
o My Albums
o Friends & Contacts
o Member List
* Forum Actions
o Mark Forums Read
o General Settings
o Edit Profile
* Quick Links
o Subscribed Threads
o Open Contacts Popup
o View Forum Leaders
o Who's Online

Cheers

--------------- Added [DATE]1278200287[/DATE] at [TIME]1278200287[/TIME] ---------------

Another self answered question... I just recreate my own within your code!! Doh!

All done :)

Rebecca217 07-16-2010 12:31 PM

This worked great for me. Thank you! :)

Lostboyfan 08-11-2010 01:18 AM

I was wondering? Is it possible for this tab to go in front of the forum tab. I'm going to call it "Home" and link it with my vbadvanced page.

If anyone can help please write back soon.

Lynne 08-11-2010 01:34 AM

Quote:

Originally Posted by Lostboyfan (Post 2081967)
I was wondering? Is it possible for this tab to go in front of the forum tab. I'm going to call it "Home" and link it with my vbadvanced page.

If anyone can help please write back soon.

As I wrote in the article:
Quote:

You may use a different template_hook here - it just depends on where you want your tab to be - navtab_start and navtab_middle are also available.
You may also change the execution order if needed if two tabs are using the same hook and you want one to go before the other.

Lostboyfan 08-11-2010 03:27 AM

Quote:

Originally Posted by Lynne (Post 2081973)
As I wrote in the article:

You may also change the execution order if needed if two tabs are using the same hook and you want one to go before the other.

Ok thank you. It worked. Must of missed that part.

Tahooma 08-11-2010 11:52 AM

If someone is using this and has the problem that the Homepage is selected, i modiefied the first line of vbcms_navbar_link to
PHP Code:

<vb:if condition="$vboptions['selectednavtab'] == 'vbcms' AND !in_array($_GET['r'], array(60))"

Where 60 is the section id (e.g. content.php?60)

Hope this works for you

--------------- Added [DATE]1281531651[/DATE] at [TIME]1281531651[/TIME] ---------------

Only one more question:
I have new NavTabs to Content Sections (e.g. content?=60) called News.
Below that i have sub-nav links to content?=61 "Sports", content?=62 "Travel",...

Now all this works fine, all are displayed and you can follow the link.
Only problem is:


If i hit one of the subNavs, "News" loses the Highligthing (Selection) and none of the Navbar is selected.
Is there a way to have News Selected when using one of its sublinks ?

OK
Got it myself

PHP Code:

$tabselected '';
$tablinks '';

if (((
$_GET['r'] == 67) || ($_GET['r'] == 68) || ($_GET['r'] == 70))&& (THIS_SCRIPT == 'vbcms'))
{
    
$vbulletin->options['selectednavtab']='content.php?r=67';
    
$tabselected ' class="selected"';
    
$tablinks '                <ul class="floatcontainer">
                        <li><a href="content.php?r=68">Fotos</a></li>
                        <li><a href="content.php?r=70">Videos</a></li>
                </ul> '


This works well, just add the sub navs into your If. v 4.0.5


Thanks in advance

pedrossi 08-13-2010 05:40 PM

Hi Lynne,

First of all thanks for all the help and the great article. Is there a way to create a new tab that links to the user's profile? For example the tab would be called "My Profile" and when the user clicks on it, it would take him to his profile as seen in member.php. On my forum, my user ID is "1", so the link would be www.myforum.com/member.php?1. But how do I do that through the plugin code? That is, how do I write a condition that only lets that tab show if the user is logged in, and to customize the link to be different for each user?

I know that the vb command
Code:

{vb:link member, {vb:raw bbuserinfo}}
generates the user-ID and username, and adding the output of that after member.php? takes me to the profile. But I tried doing something like this:
Code:

<a href="member.php?{vb:link member, {vb:raw bbuserinfo}}">
yet it didn't work.

Thanks!

cellarius 08-13-2010 05:57 PM

No need for the member.php? in front of the variable - it contains the complete link, including the path and file.

Just try
Code:

<a href="{vb:link member, {vb:raw bbuserinfo}}">{vb:rawphrase your_profile}</a>

pedrossi 08-13-2010 07:42 PM

Quote:

Originally Posted by cellarius (Post 2083327)
No need for the member.php? in front of the variable - it contains the complete link, including the path and file.

Just try
Code:

<a href="{vb:link member, {vb:raw bbuserinfo}}">{vb:rawphrase your_profile}</a>

When I tried to implement this code into the plugin code Lynne provided, it seems vBulletin isn't 'parsing' (is this the right term?) the code. So what I end up with is a tab called {vb:rawphrase your_profile}, and instead of taking me to
Code:

http://myforum.com/member.php?1-username
it takes me to
Code:

http://myforum.com/{vb:link member, {vb:raw bbuserinfo}}
. Any ideas on how to get vBulletin to parse the {vb} tags inside a plugin?

Thanks!

Lynne 08-13-2010 07:54 PM

You need to use php in a plugin. {vb:template stuff} is not php. You need to use actual $variables.

pedrossi 08-13-2010 07:56 PM

Quote:

Originally Posted by Lynne (Post 2083390)
You need to use php in a plugin. {vb:template stuff} is not php. You need to use actual $variables.

How can I get the results from the {vb:template stuff} into a PHP variable then? Or, how can I use PHP to figure out what the user's ID is? Still new to vb modding... :D

Lynne 08-13-2010 07:59 PM

If you look in the php code, then you will see how to call out stuff using php. If you want *your* userid, then it would be $vbulletin->userinfo['userid'].

pedrossi 08-13-2010 08:30 PM

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>' ;




Boofo 08-14-2010 10:32 PM

Thank you, Lynne, for the well thought out article. I have been trying to figure this out for 2 days now. You made it easy, young lady. ;)

For anyone interested, here is all you need to make a W3C button that will check the markup validation for whatever page of the site you are currently on.

PHP Code:

$template_hook['navtab_end'] .= '<li><a class="navtab" href="http://validator.w3.org/check?uri=referer" target="_blank">W3C</a></li>'


pedrossi 08-15-2010 09:08 PM

So I added a link to the user's private message inbox as a sublink to my new tab, but when I click on that it activates the "forum' tab instead of the new tab. Any ideas on what files I have to modify to get the new tab to be activated instead of the forum tab? I'm guessing I need to find a certain condition and change it?

Boofo 08-15-2010 10:20 PM

It should stay with the new tab when it is clicked. Does the tab itself stay selected when you click it?

pedrossi 08-16-2010 02:27 AM

Quote:

Originally Posted by Boofo (Post 2084501)
It should stay with the new tab when it is clicked. Does the tab itself stay selected when you click it?

Yep, it does. I'm thinking it has to do with all that THIS_SCRIPT business, and that there is piece of code that's telling the Forum tab to select itself if I am on the inbox page... but I need to find that piece of code and change it so that it instead selects the New Tab. I could be wrong, though...

I'm thinking I could add a condition to the plugin that says the new tab should be selected if THIS_SCRIPT is the inbox, but that would create a conflict and both the new tab and the forum tab would select themselves, causing a big mess.

Boofo 08-16-2010 03:20 AM

Any sub-link you add needs to be under the navbar button you want to user it with. Like you did with the My Profile code.

pedrossi 08-16-2010 05:37 AM

Quote:

Originally Posted by Boofo (Post 2084587)
Any sub-link you add needs to be under the navbar button you want to user it with. Like you did with the My Profile code.

Here's what I've got right now:

http://cl.ly/20PD


When I click the "My Profile" tab, it becomes selected and it shows the right sub-links. "Career Talk" is what I have renamed my "Forum" tab to.

When I click on the sub-link "Inbox", though, it takes the user to the private messages page, but now the "Career Talk" tab becomes selected:

http://cl.ly/20N6

And here is my code:

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>' ;



I'm slowly getting there, just need a push in the right direction :D


All times are GMT. The time now is 08:43 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02044 seconds
  • Memory Usage 1,982KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (14)bbcode_code_printable
  • (6)bbcode_php_printable
  • (12)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete