PDA

View Full Version : Navtab order


Laurent42
03-19-2011, 04:49 PM
I have recently installed the Media Library plugin for vBulletin 4.x.

After the installation, a 'media' navtab is created after the default forum tab.
I wanted to change the order of the media tab, to put it at the first place.

I have replaced the following hook:
template_hook['navtab_middle'] .= $templater->render();
with
template_hook['navtab_start'] .= $templater->render();

It works well, my first tab now is media and the second one is the forum tab.

The new problem is...
That's the second tab (Forum tab) is selected by default when I go on the root of the Web site. What should I hook/do in order to have my first tab selected by default ?

:)

Here is the code of the plugin if it can help:
if (THIS_SCRIPT == '8WR_media')
{
require_once(DIR.'/media/media_functions_hrefs.php');
require_once(DIR.'/media/media_functions_perms.php');

$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();