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
  #62  
Old 10-30-2008, 11:04 AM
Blackhat's Avatar
Blackhat Blackhat is offline
 
Join Date: Mar 2005
Posts: 323
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

so if I want to add entries to the user cp, is this something similar to that ?
Reply With Quote
  #63  
Old 10-30-2008, 02:09 PM
Lynne's Avatar
Lynne Lynne is offline
 
Join Date: Sep 2004
Location: California/Idaho
Posts: 41,180
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Blackhat View Post
so if I want to add entries to the user cp, is this something similar to that ?
No, this is for adding stuff in the admin cp. You are probably thinking of profile fields which usually show up in the users cp.
Reply With Quote
  #64  
Old 10-30-2008, 02:31 PM
Blackhat's Avatar
Blackhat Blackhat is offline
 
Join Date: Mar 2005
Posts: 323
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im thinking of attaching a file to a custom menu entry in the user cp where I can run my custom code inside
Reply With Quote
  #65  
Old 11-03-2008, 02:32 PM
ptmuldoon ptmuldoon is offline
 
Join Date: Feb 2005
Posts: 78
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the great How To and tip. I'm learning to create a new mod, and was wondering exactly how to add new items to the Admin Menu. Quick question....

When adding a new xml file to add to the menu, it shows the new menu item in vbulletin with a * and [] brackets. Is that normal? It is showing it as

*[My New Mod]*
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 12:13 AM.


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.03879 seconds
  • Memory Usage 2,260KB
  • Queries Executed 22 (?)
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
  • (1)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
  • (5)post_thanks_box
  • (5)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (5)post_thanks_postbit_info
  • (4)postbit
  • (5)postbit_onlinestatus
  • (5)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_postinfo_query
  • fetch_postinfo
  • 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