Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 4 Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
[HOW TO - vB4] Remove the vB Default Navtabs
Lynne's Avatar
Lynne
Join Date: Sep 2004
Posts: 41,180

 

California/Idaho
Show Printable Version Email this Page Subscription
Lynne Lynne is offline 01-25-2010, 10:00 PM

[HOW TO - vB4] Remove the vB Default Navtabs

Here is a quick article on how to remove some of the default vbulletin navtabs from the navbar template.

Removing the What's New navtab:

Find (near the top of the template):
Code:
        <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
Change to:
Code:
        <vb:if condition="!$vboptions['selectednavtab']">
Find and Remove (about 2/3 down):
Code:
        <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT == 'search'">
            <vb:if condition="$show['member']">
            <li  class="selected"><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase getnew_tab}</a>
...
a bunch more stuff inbetween to remove
...
            </li>
            </vb:if>
        <vb:elseif condition="$show['member']" />
            <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getnew&amp;contenttype=vBForum_Post">{vb:rawphrase getnew_tab}</a></li>
        <vb:else />
            <li><a class="navtab" href="search.php?{vb:raw session.sessionurl}do=getdaily&amp;contenttype=vBForum_Post">{vb:rawphrase getnew_tab}</a></li>
        </vb:if>
SAVE

In a default navbar template, after removing the chunk of code above, you should end up with this in the template where the code used to be:
Code:
        {vb:raw template_hook.navtab_middle}

        {vb:raw template_hook.navtab_end}
Removing the Home navtab:
Go to Plugins & Products > Plugin Manager > Product: vBulletin CMS > Navbar: Insert CMS Navbar Entry
Plugin is Active: NO
SAVE


Removing the Blogs navtab:
Go to Plugins & Products > Plugin Manager > Product: vBulletin Blog > Navbar: Eval Blog Link Template and Validate Styleid
Find and Remove (or comment out):
Code:
if (defined('VBBLOG_CACHED_TEMPLATES'))
{
    if (defined('VBBLOG_SCRIPT'))
    {
        $vbulletin->options['selectednavtab'] = 'vbblog';
    }
    $template_hook['navtab_middle'] .= vB_Template::create('blog_navbar_link')->render();
        $template_hook['navbar_getnew_menu'] .= vB_Template::create('blog_navbar_whatsnew_link')->render();
    if ($show['blog_search'])
    {
        $template_hook['navbar_search_menu'] .= vB_Template::create('blog_navbar_search')->render();
    }
}
SAVE

Removing the Forum navtab:

Find and remove (starts near the very top):
Code:
        <vb:if condition="!$vboptions['selectednavtab'] AND THIS_SCRIPT != 'search'">
  ...
a bunch more stuff inbetween to remove
...
        <vb:else />
            <li><a class="navtab" href="{vb:link forumhome}">{vb:rawphrase forum}</a></li>
        </vb:if>
SAVE

Other related articles of possible interest:
[HOW TO - vB4] Create a New Tab in the navbar
[HOW TO - vB4] Create your own vBulletin page
Reply With Quote
  #72  
Old 03-17-2011, 09:28 PM
Laurent42 Laurent42 is offline
 
Join Date: Feb 2011
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
So the MediaLibrary tab shows up if you have it set to navtab_middle but not if you have it set to navtab_left?
Exactly!

Quote:
Have you looked in your navbar template to verify you have that template_hook there?
There is no navtab_left hook called in the navbar template? It should? In the default template there is one??

I do not have modified my default template and by doing a search, I do not find navtab_left hook in the default navbar!

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

Ok, I have fixed the problem.

I just needed to hook navtab_start. =)
But I do not understand the difference of navtab_left/navtab_start.

So good to know => the first element is navtab_start and not navtab_left...

A big thanks to Lynne for his/her time!
Reply With Quote
  #73  
Old 03-19-2011, 10:26 AM
Laurent42 Laurent42 is offline
 
Join Date: Feb 2011
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So now my tabs in the correct order!

My custom tab is the first one.
The forum tab is the second one.

The new problem I have is...
That's the second tab that is selected by default.

What should I hook in order to have my first tab selected by default when I go on the site?
Attached Images
File Type: png pb.png (10.9 KB, 0 views)
Reply With Quote
  #74  
Old 03-19-2011, 11:50 AM
Laurent42 Laurent42 is offline
 
Join Date: Feb 2011
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Maybe this can help, here is the plugin code:

Code:
    $perms = media_permissions();

    $vbulletin->options['selectednavtab'] = 'media';

    $categories = $vbulletin->db->query_read("
        SELECT * FROM ".TABLE_PREFIX."media_category
        WHERE catOrder != '0'
        ORDER BY catOrder
    ");

    $href['playlists'] = construct_href_playlists();
    $href['pmine'] = construct_href_playlists_mine();
    $href['pcreate'] = construct_href_playlists_create();
    $href['favorites'] = construct_href_favorites();
    $href['subscriptions'] = construct_href_subscriptions();
    $href['submit'] = construct_href_submit();
    $href['random'] = construct_href_random();
    $href['cats'] = construct_href_admin("cats");
    $href['tags'] = construct_href_admin("tags");
    $href['host'] = construct_href_admin("host");

    while ($category = $vbulletin->db->fetch_array($categories))
    {
        $category['href'] = construct_href_category($category);

        $category['align'] = "";
        for ($i = 0; $i < $category['catDepth']; $i++) { $category['align'] .= '-- '; }

        $templater = vB_Template::create('8WR_media_NAVTAB_cat');
        $templater->register('category', $category);
        $categorybits .= $templater->render();
    }
}

$templater = vB_Template::create('8WR_media_NAVTAB');
$templater->register('perms', $perms);
$templater->register('href', $href);
$templater->register('categorybits', $categorybits);
$template_hook['navtab_start'] .= $templater->render();
Reply With Quote
  #75  
Old 03-19-2011, 04:20 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You know this is an article about removing default navtabs, right? I just realized that you are talking about adding a navtab which has nothing to do with this article.

But anyway, if you need someone to try to debug your plugin, you should post your own thread. I do notice you have an extra } just sitting in there without a beginning.
Reply With Quote
  #76  
Old 03-19-2011, 04:35 PM
Laurent42 Laurent42 is offline
 
Join Date: Feb 2011
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok, I'm going to start a new thread.

For the '}' it's ok, the beginning of the code has not been pasted.

ps: It's not my plugin, but a well known (Media Library).
Reply With Quote
  #77  
Old 04-02-2011, 05:07 AM
screenmates screenmates is offline
 
Join Date: Sep 2009
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi Lynne,

vB 4.1.2

We tried several times to remove the code precisely as you suggested from the navbar template but the What's New button remains intact. Also tried clearing CMS cache but no luck. Has something else changed in 4.1.2 and do we need to do anything special?

Please help...

Thanks!
Reply With Quote
  #78  
Old 04-02-2011, 03:40 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Make sure you are editing the correct style. There is no way you could remove all that code and still have the tab. If you are not using a default style, then make sure it isn't in there twice. And, make sure a modification is not adding the tab.
Reply With Quote
  #79  
Old 05-12-2011, 10:43 PM
CardMafia CardMafia is offline
 
Join Date: Jun 2008
Posts: 43
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you for this article! Very helpful and less involved than the first article I read on the subject.
Reply With Quote
  #80  
Old 07-25-2011, 06:33 PM
sortega sortega is offline
 
Join Date: Jul 2011
Posts: 3
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I made the changes above as best I could and got the following error message when complete (it did remove my "Home" and "Blog" buttons which is what I wanted)

"Parse error: syntax error, unexpected '<' in /home2/hersheyi/public_html/forum/includes/class_bootstrap.php(537) : eval()'d code on line 9"

but how do I correct that?

I did notice that for your removing the Blog button code your code did not match mine (see both exampled below) so I commented out the section I thought applied.

Yours:
Code:
if (defined('VBBLOG_CACHED_TEMPLATES'))
{
    if (defined('VBBLOG_SCRIPT'))
    {
        $vbulletin->options['selectednavtab'] = 'vbblog';
    }
    $template_hook['navtab_middle'] .= vB_Template::create('blog_navbar_link')->render();
        $template_hook['navbar_getnew_menu'] .= vB_Template::create('blog_navbar_whatsnew_link')->render();
    if ($show['blog_search'])
    {
        $template_hook['navbar_search_menu'] .= vB_Template::create('blog_navbar_search')->render();
    }
}
Mine:
Code:
<!-- if (defined('VBBLOG_CACHED_TEMPLATES'))
{
	if (defined('VBBLOG_SCRIPT'))
	{
		$vbulletin->options['selectednavtab'] = 'vbblog';
	}
	$template_hook['navtab_middle'] .= vB_Template::create('blog_navbar_link')->render();
        $template_hook['navbar_getnew_menu'] .= vB_Template::create('blog_navbar_whatsnew_link')->render();
} -->


if (STYLEID != $vbulletin->userinfo['blogstyleid'])
{
	$vbulletin->userinfo['blocktext'] = '';
}
HELP!
Reply With Quote
  #81  
Old 07-25-2011, 10:40 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

That is not how you comment out php. You use /* at the beginning and */ at the end. If you use those for that section that you showed, then it will work. <!-- and --> are used for commenting out html.
Reply With Quote
Благодарность от:
sortega
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:25 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04605 seconds
  • Memory Usage 2,344KB
  • Queries Executed 26 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (9)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (9)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (2)post_thanks_postbit
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (1)postbit_attachment
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete