If you are creating a product and you want to add a tabs menus or links as part of that product then the standard way is quite simple.

In the navigation manager (on the forum you are developing the product) simply add the elements you want, making sure that on the add screen you change the product from
the default of vBulletin to you own product (make sure you are in debug mode). Remember to create any custom show variables (in hooks) if you are using them to control the display of your elements.

When you have finished, the navigation elements will be exported in the product XML along with everything else. If you view the XML, you will see them at the bottom.

You can of course manually add (or edit) the appropriate XML if you prefer to do it that way (I prefer to edit the identifications to something more meaningful, but make sure they are still likely to be unique, otherwise clashes will occur when someone installs it).

For an example of how this can be done, take my Top Posters modification. This adds a link either in the Community Menu, or Quick Links Menu (set by an option).

In 4.1.x this was done by the code below (on the parse_templates hook);

PHP Code:
if ($vbulletin->options['toplink'] == 1)
{
    
$template_hook['navbar_community_menu_end'] .= '<li><a href="'.$vbulletin->options['toppath'].'misc.php?'.$session['sessionurl'].'do=topposters">'.$vbphrase['top_list'].'</a></li>';
}
if (
$vbulletin->options['toplink'] == 2)
{
    
$template_hook['navbar_quick_links_menu_pos1'] .= '<li><a href="'.$vbulletin->options['toppath'].'misc.php?'.$session['sessionurl'].'do=topposters">'.$vbphrase['top_list'].'</a></li>';

Basically, if the toplink option was 1, it added the link to Community Menu, if it was 2, it added it to the Quick Links Menu, if it was neither, no link was added.


The same result can be done in 4.2.x but its done differently ;

The following code is added to the load_show_variables hook.

PHP Code:
if ($vbulletin->options['toplink'] == 1)
{
    
$show['topcm'] = true;
    
$show['topql'] = false;
}
else if (
$vbulletin->options['toplink'] == 2)
{
    
$show['topcm'] = false;
    
$show['topql'] = true;
}
else
{
    
$show['topcm'] = false;
    
$show['topql'] = false;

This defines two custom show variables (used by the Nav Links to determine if they display or not).

The two links appear in the XML as below ;

PHP Code:
        <phrasetype name="GLOBAL" fieldname="global">
            <
phrase name="vb_navigation_link_top_link_cm_text" date="1340000000" username="Paul M" version="4.2.0.0"><![CDATA[Top Posters]]></phrase>
            <
phrase name="vb_navigation_link_top_link_ql_text" date="1340000000" username="Paul M" version="4.2.0.0"><![CDATA[Top Posters]]></phrase>
        </
phrasetype>

    <
navigation>
        <
link name="top_link_cm" date="1340000000" username="Paul M" version="4.2.0.0">
            <
active>1</active>
            <
show>topcm</show>
            <
parent>vbmenu_community</parent>
            <
displayorder>50</displayorder>
            <
url><![CDATA[{options.toppath}misc.php?{session.sessionurl}do=topposters]]></url>
        </
link>
        <
link name="top_link_ql" date="1340000000" username="Paul M" version="4.2.0.0">
            <
active>1</active>
            <
show>topql</show>
            <
parent>vbmenu_qlinks</parent>
            <
displayorder>60</displayorder>
            <
url><![CDATA[{options.toppath}misc.php?{session.sessionurl}do=topposters]]></url>
        </
link>
    </
navigation
This is not the only way it can be done, but for static links this is probably the simplest way.



If you want to be a bit more adventurous, you can add links directly into the Navdata Menu array, so they will be displayed when it builds the display.

In my example, this can be done by adding the following code on the hook 'build_navigation_array'

PHP Code:
if (vB::$vbulletin->options['toplink'] == 1)
{
    
$link1 = array(
        
'name' => 'top_link_cm',
        
'navtype' => 'link',
        
'url' => '{options.toppath}misc.php?{session.sessionurl}do=topposters',
        
'active' => 1,
        
'productid' => 'paulm_top_42',
        
'text' => $vbphrase['top_list'],
    );

    
$result['vbtab_forum']['links']['vbmenu_community']['links']['top_link_cm'] = $link1;
}
else if (
vB::$vbulletin->options['toplink'] == 2)
{
    
$link2 = array(
        
'name' => 'top_link_ql',
        
'navtype' => 'link',
        
'url' => '{options.toppath}misc.php?{session.sessionurl}do=topposters',
        
'active' => 1,
        
'productid' => 'paulm_top_42',
        
'text' => $vbphrase['top_list'],
    );

    
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['top_link_ql'] = $link2;

The above code will always append the new links at last place in the menu.

To insert them based on a display value needs a bit of extra code.

PHP Code:
if (vB::$vbulletin->options['toplink'] == 1)
{
    
$link1 = array(
        
'name' => 'top_link_cm',
        
'navtype' => 'link',
        
'url' => '{options.toppath}misc.php?{session.sessionurl}do=topposters',
        
'active' => 1,
        
'displayorder' => 15,
        
'productid' => 'paulm_top_42',
        
'text' => $vbphrase['top_list'],
    );

    
$result['vbtab_forum']['links']['vbmenu_community']['links']['top_link_cm'] = $link1;
    
uasort($result['vbtab_forum']['links']['vbmenu_community']['links'], 'top_links_sort');
}
else if (
vB::$vbulletin->options['toplink'] == 2)
{
    
$link2 = array(
        
'name' => 'top_link_ql',
        
'navtype' => 'link',
        
'url' => '{options.toppath}misc.php?{session.sessionurl}do=topposters',
        
'active' => 1,
        
'displayorder' => 25,
        
'productid' => 'paulm_top_42',
        
'text' => $vbphrase['top_list'],
    );

    
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['top_link_ql'] = $link2;
    
uasort($result['vbtab_forum']['links']['vbmenu_qlinks']['links'], 'top_links_sort');
}

function 
top_links_sort($a$b)
{
    return (
$a['displayorder'] == $b['displayorder'] ? : ($a['displayorder'] > $b['displayorder'] ? : -1));