[How-To] Adding Link to USERCP Navbar
by
23 May 2007
Hello
I felt i needed to contribute this post to the articles since i couldn't find a good one anywhere.
This tutorial explains how to create an additional link to your USERCP Navbar
*Note - I couldn't write in Articles, so might as well wait for the Moderator's here to move it over to articles.
1. Template USERCP_SHELL
Under
PHP Code:
<!-- usercp nav -->
<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0">
<tr>
<td class="tcat"><a href="usercp.php$session[sessionurl_q]">$vbphrase[control_panel]</a></td>
</tr>
Add
PHP Code:
<tr>
<td class="thead">Sample Options</td>
</tr>
<tr>
<td class="$navclass[sample]" nowrap="nowrap"><a class="smallfont" href="sample.php">Sample</a></td>
</tr>
Replace sample with the title of your menu which you want to display in usercp navbar.
2. Modify includes/functions_user.php
Under
PHP Code:
$cells = array(
'usercp',
Add
PHP Code:
$cells = array(
'usercp',
'sample',
3. Create sample.php in vBulletin root directory
PHP Code:
<?php
// ####################### SET PHP ENVIRONMENT ###########################
error_reporting(E_ALL & ~E_NOTICE);
// #################### DEFINE IMPORTANT CONSTANTS #######################
define('NO_REGISTER_GLOBALS', 1);
define('THIS_SCRIPT', 'sample'); // change this depending on your filename
// ################### PRE-CACHE TEMPLATES AND DATA ######################
// get special phrase groups
$phrasegroups = array('user', 'infractionlevel');
// get special data templates from the datastore
$specialtemplates = array(
);
// pre-cache templates used by all actions
$globaltemplates = array(
'USERCP_SHELL',
);
// pre-cache templates used by specific actions
$actiontemplates = array(
);
// ######################### REQUIRE BACK-END ############################
require_once('./global.php');
require_once('includes/functions_user.php');
// Prevent Non-registered Users from Previewing
if (!$vbulletin->userinfo['userid'])
print_no_permission();
// Start Navbar
$navbits = array('usercp.php' . $vbulletin->session->vars['sessionurl_q'] => $vbphrase['user_control_panel']);
construct_usercp_nav('sample');
$navbits[''] = 'Sample';
// Print Content, Navigationbar
// eval('$content .= "' . fetch_template('sample') . '";');
// Make Navbar
$navbits = construct_navbits($navbits);
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('print_output("' . fetch_template('USERCP_SHELL') . '");');
?>
Hope you'll find this useful.
Written for 3.6.X (well up to 3.6.7 tested)
credits goes to Kerry-Anne for her comprehensive instruction page, How To Add Drop Down Menus To Your Navbar
|