PDA

View Full Version : [How-To] Adding Link to USERCP Navbar


byon
23 May 2007, 11:29
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
<!-- 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

<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

$cells = array(
'usercp',

Add

$cells = array(
'usercp',
'sample',



3. Create sample.php in vBulletin root directory

<?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. :D


Written for 3.6.X (well up to 3.6.7 tested) :D

credits goes to Kerry-Anne for her comprehensive instruction page, http://www.vbulletin.org/forum/showthread.php?t=122523

ragtek
26 May 2007, 19:48
step 2 is false!

that you make per pluginsystem not per filemodify
hook: usercp_nav_start!
code:
$cells[] = 'sample'; ;)

coderphp
07 Nov 2009, 02:22
this article is wonderful
Iwonder how it dont have much replies

Thanks

Hell Bomb
11 Jul 2010, 11:09
Ok, i still can't figure out how to display anything >.<