Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles

Reply
 
Thread Tools
[How-To] Add entries to AdminCP Navigation Menu
Andreas's Avatar
Andreas
Join Date: Jan 2004
Posts: 6,863

 

Germany
Show Printable Version Email this Page Subscription
Andreas Andreas is offline 06-07-2005, 10:00 PM

The AdminCP Navigation is now controlled through XML files.
To add custom entries, you must create a new file cpnav_yourhack.xml and place it in directory includes/xml.

This XML-File constist of 6 important tags:
  • <navgroups>
    This indicates that this is a XML File containing navgroups.
    It has one parameter product that should be set to your product identifier or vbulletin if it does not belong to any product.
  • <navgroup>
    This is the container for one Settings-Group, like Styles & Templates, vBulletin Options, etc.
    It has three parameters: phrase/text, permissions and hr.
    If you are using phrases, phrase must contain the variable name, if you are using hardcoded text then text must contain the label.
    Parameter permissions (optional) can be used to check an administrator permission, like canadminoptions.
    Parameter hr (optional) can be used to put a spacer below this navgroup.
  • <navoption>
    This is one Menu-Entry.
  • <phrase> or <text>
    This must contain the varname or hardcoded text for the menuetry.
  • <link>
    Tag link must contain the URL.
    You can use {$vbulletin->config[Misc][modcpdir]} to point to the ModCP directory here, no matter how it is actually called

Example
HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<navgroups product="vbulletin">
	<navgroup phrase="demohack_settings" hr="true">
		<navoption>
			<phrase>demohack_foo</phrase>
			<link>demohack.php?do=foo</link>
		</navoption>
		<navoption>
			<phrase>demohack_modcp</phrase>
			<link>../{$vbulletin->config[Misc][modcpdir]}/foobar.php</link>
		</navoption>
	</navgroup>
	<navgroup text="Demohack Settings">
		<navoption>
			<text>Demohack Foo</text>
			<link>demohack.php?do=foo</link>
		</navoption>
		<navoption>
			<text>Demohack ModCP</text>
			<link>../{$vbulletin->config[Misc][modcpdir]}/foobar.php</link>
		</navoption>
	</navgroup>
</navgroups>
Update for Beta 3
With Beta 3 a new parameter displayorder has been introduced. This parameter is valid for Tags navgroup and navoption.
This way it is possible to control in which order the Navgroups and Links will be displayed, and you can also add custom Links to existing Navgroups.
To do so, your navgroup must have them same displayorder and Phrase Varname as the existing group:

HTML Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<navgroups product="vbulletin">
	<navgroup phrase="forums_and_moderators" displayorder="60">
		<navoption displayorder="1">
			<text>Top-Link Forums &amp; Moderators</text>
			<link>demohack.php?do=foo</link>
		</navoption>
	</navgroup>
</navgroups>
Then Top-Link Forums & Moderators will be the first link in Navgroup Forums & Moderators (Displayorder: 60).

To find out the Displayorder for existing groups, take a look at cpnav_vbulletin.xml.

This How-To is (C) 2005 by KirbyDE and you are not allowed to redistribute it in any way without my explicit consent.
Reply With Quote
  #2  
Old 06-13-2005, 08:51 PM
Creative Suite's Avatar
Creative Suite Creative Suite is offline
 
Join Date: May 2004
Location: Kuwait :)
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks..
Reply With Quote
  #3  
Old 06-13-2005, 09:20 PM
rjordan's Avatar
rjordan rjordan is offline
 
Join Date: Sep 2004
Posts: 326
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

So, in doing this, does this take care of the issues with no hooks being included in the AdminCP navigation menu? I know that it does not take care of not having hooks in the individual modules, just refering to the main selection menu.
Reply With Quote
  #4  
Old 06-15-2005, 03:10 AM
feldon23's Avatar
feldon23 feldon23 is offline
 
Join Date: Oct 2001
Posts: 124
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rjordan
So, in doing this, does this take care of the issues with no hooks being included in the AdminCP navigation menu? I know that it does not take care of not having hooks in the individual modules, just refering to the main selection menu.
Site administrators upload the XML file prepared by the hack author and presto, new items appear in the AdminCP.

The bummer here is that hack authors can't specify which existing group to add a menu item under (for instance, adding a new PM-related funtion or feature under the existing PM AdminCP tree) nor can hack authors specify a group that their hack should appear above or below. A hack author might want to add "Clans" right below Usergroups or Promotions.

I'm guessing that new menus created with this XML technique appear way at the bottom?

Of course to add all the functionality I am talking about, the admincp XML file would need to be cached in a "merged" state.
Reply With Quote
  #5  
Old 06-22-2005, 06:13 AM
stlmike stlmike is offline
 
Join Date: Mar 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks KirbyDE in how to do this...
Reply With Quote
  #6  
Old 06-22-2005, 11:12 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by feldon23
Site administrators upload the XML file prepared by the hack author and presto, new items appear in the AdminCP.

The bummer here is that hack authors can't specify which existing group to add a menu item under (for instance, adding a new PM-related funtion or feature under the existing PM AdminCP tree) nor can hack authors specify a group that their hack should appear above or below. A hack author might want to add "Clans" right below Usergroups or Promotions.

I'm guessing that new menus created with this XML technique appear way at the bottom?

Of course to add all the functionality I am talking about, the admincp XML file would need to be cached in a "merged" state.
They seem to appear at either the top or bottom, quite randomly...

It is bizzarre to be sure...

I hope the Devs listen to the requests and create some kind of display order feature for the CP Nav

Satan
Reply With Quote
  #7  
Old 06-22-2005, 11:16 AM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hellsatan
They seem to appear at either the top or bottom, quite randomly...
They appear in the sort-order that is provided by the OS when you list cpnav_*.xml Files.
Reply With Quote
  #8  
Old 06-22-2005, 11:18 AM
Chris M's Avatar
Chris M Chris M is offline
 
Join Date: Dec 2001
Location: Northampton, England
Posts: 6,186
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aha - Glad someone knows

Satan
Reply With Quote
  #9  
Old 06-27-2005, 07:12 PM
Dream's Avatar
Dream Dream is offline
 
Join Date: Oct 2001
Posts: 2,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so kirby what changed in vb 3.5 beta 3? are you going to update this
Reply With Quote
  #10  
Old 06-27-2005, 07:24 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Updated
Reply With Quote
Reply

Thread Tools

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 09:28 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.04702 seconds
  • Memory Usage 2,312KB
  • Queries Executed 24 (?)
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
  • (2)bbcode_html
  • (3)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
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete