Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > Programming Articles
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Want to add multiple drop-down menus in your Navbar?
JenniferK
Join Date: Dec 2005
Posts: 149

 

Show Printable Version Email this Page Subscription
JenniferK JenniferK is offline 09-14-2006, 10:00 PM

I needed this for my new forum but was unable to find a hack that currently does that. So I figured out how to do it myself. I'm sharing it in case anyone else is interested, but please know I am in no way, shape or form a coder, so any help I can give will be extremely limited.

I figured it out by looking at the navbar template and pulling out the chunk of code that makes the "quick links" drop down. I copied it, modified it then added it to the template but it still didn't work (because I didn't realize there were two things that needed to be edited). Ultimately, I went to the online manual at VBulletin.com and searched for popup menu (yes I actually read the manual directions, lol) and used that to help me further. The second drop-down I even added conditionals to make it so only staff sees it is there, and only admins can see some of the links. Here is the code I used with the conditionals (if you want everyone to see it, just edit those out). I have this dropdown after the Quick Links dropdown and this is where I placed the code.

Find:
HTML Code:
<if condition="$show['member']">
			<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out()">$vbphrase[log_out]</a></td>
		</if>
Place this above (after editing it for your site):
HTML Code:
<if condition="is_member_of($bbuserinfo,5,6,7)">				
<td id="stafflinks" class="vbmenu_control"><a href="$show[nojs_link]#stafflinks">Staff Links</a> <script type="text/javascript"> vbmenu_register("stafflinks"); </script></td>
</if>

Find:
HTML Code:
 <if condition="$show['member']">
	<!-- user cp tools menu -->
	<div class="vbmenu_popup" id="usercptools_menu" style="display:none">
		<table cellpadding="4" cellspacing="1" border="0">
		
		<tr><td class="thead">$vbphrase[quick_links]</td></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/faq.php">FAQ</a></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/view.php?pg=useragreement">User Agreement</a></tr>
		
		<if condition="$vboptions['enablesearches']"><tr><td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td></tr></if>
		<tr><td class="vbmenu_option"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/memberlist.php">Members List</a></tr>
		<tr><td class="vbmenu_option"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_buddy_list]</a></td></tr>
				
		<tr><td class="thead"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_control_panel]</a></td></tr>
		<if condition="$show['siglink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editsignature">$vbphrase[edit_signature]</a></td></tr></if>
		<!--<if condition="$show['avatarlink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editavatar">$vbphrase[edit_avatar]</a></td></tr></if>-->
		<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editprofile">$vbphrase[edit_profile]</a></td></tr>
		<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editoptions">$vbphrase[edit_options]</a></td></tr>
		
		<tr><td class="thead">$vbphrase[miscellaneous]</td></tr>
		<if condition="$show['pmstats']"><tr><td class="vbmenu_option"><a href="private.php$session[sessionurl_q]" rel="nofollow">$vbphrase[private_messages]</a></td></tr></if>
		<tr><td class="vbmenu_option"><a href="subscription.php$session[sessionurl_q]" rel="nofollow">$vbphrase[subscribed_threads]</a></td></tr>
		<tr><td class="vbmenu_option"><a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[my_profile]</a></td></tr>
		<if condition="$show['wollink']"><tr><td class="vbmenu_option"><a href="online.php$session[sessionurl_q]">$vbphrase[whos_online]</a></td></tr></if>
		
		</table>
	</div>
	<!-- / user cp tools menu -->
	</if>
Place this below (after editing it for your site):
HTML Code:
 <if condition="is_member_of($bbuserinfo,5,6,7)"> 
<!-- staff links menu--> 
<div class="vbmenu_popup" id="stafflinks_menu" style="display:none"> <table cellpadding="4" cellspacing="1" border="0"> 
<tr><td class="thead">Staff Links</td></tr> 
<if condition="is_member_of($bbuserinfo,5,6,7)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/view.php?pg=staffguidelines">Staff Guidelines</a></td></tr></if> 
<if condition="is_member_of($bbuserinfo,6)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum//misc.php?do=moderator_stats">Mod Stats</a></td></tr></if> 
<if condition="is_member_of($bbuserinfo,6)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/spiders.php?">Spiders</a></td></tr></if> 
<if condition="is_member_of($bbuserinfo,5,6,7)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/modcp/index.php">Mod CP</a></td></tr></if> 
<if condition="is_member_of($bbuserinfo,6)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/admincp/index.php">Admin CP</a></td></tr></if> 
</table>
 </div> 
<!-- / staff links menu -->
 </if>
Hope this helps someone!
Reply With Quote
  #12  
Old 10-29-2006, 08:36 PM
Chicago_VLNU_4s Chicago_VLNU_4s is offline
 
Join Date: Mar 2006
Location: Chicago
Posts: 453
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanks... needed this
Reply With Quote
  #13  
Old 10-31-2006, 04:27 PM
ngaiox ngaiox is offline
 
Join Date: Aug 2006
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Is there any way someone could do this for me?

If you can here are the details:

I want the super moderators and the administrators to be able to see the link.

I want the dropdown menu name to be Administration. Inside of it, I want there to be two links. Admin CP and Mod CP. Admin CP is the link only members of the usergroup Administrators can see. And Mod CP is the link only members of the usergroup Super Moderators can see. Is that going to be a problem doing this for me? I will appriciate it if you do.

PS: I need to learn the scripting of the templates better, lol.
Reply With Quote
  #14  
Old 11-19-2006, 10:10 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ok here ya go:
Go into your adminCP ->Styles and templates -> style manager -> default style -> select edit templates -> scroll down to 'navigation/breadcrump templates'and double click that -> navbar

Like Jennifer K says

Find:
HTML Code:
<if condition="$show['member']">
			<td class="vbmenu_control"><a href="login.php?$session[sessionurl]do=logout&amp;logouthash=$bbuserinfo[logouthash]" onclick="return log_out()">$vbphrase[log_out]</a></td>
		</if>
Place this above (after editing it for your site):
HTML Code:
<if condition="is_member_of($bbuserinfo,5,6,7)">				
<td id="stafflinks" class="vbmenu_control"><a href="$show[nojs_link]#stafflinks">Staff Links</a> <script type="text/javascript"> vbmenu_register("stafflinks"); </script></td>
</if>
Now where it says
HTML Code:
5,6,7
means super mods(5), admins(6) and mods(7)
If you dont want your super mods to see this then delete
HTML Code:
5,
The same goes for the code below.

Then find:
HTML Code:
 <if condition="$show['member']">
	<!-- user cp tools menu -->
	<div class="vbmenu_popup" id="usercptools_menu" style="display:none">
		<table cellpadding="4" cellspacing="1" border="0">
		
		<tr><td class="thead">$vbphrase[quick_links]</td></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/faq.php">FAQ</a></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/view.php?pg=useragreement">User Agreement</a></tr>
		
		<if condition="$vboptions['enablesearches']"><tr><td class="vbmenu_option"><a href="search.php?$session[sessionurl]do=getdaily">$vbphrase[todays_posts]</a></td></tr></if>
		<tr><td class="vbmenu_option"><a href="forumdisplay.php?$session[sessionurl]do=markread">$vbphrase[mark_forums_read]</a></td></tr>
<tr><td class="vbmenu_option"><a href="http://www.huntleyneighbors.com/forum/memberlist.php">Members List</a></tr>
		<tr><td class="vbmenu_option"><a href="#" onclick="window.open('misc.php?$session[sessionurl]do=buddylist&amp;focus=1','buddylist','statusbar=no,menubar=no,toolbar=no,scrollbars=yes,resizable=yes,width=250,height=300'); return false;">$vbphrase[open_buddy_list]</a></td></tr>
				
		<tr><td class="thead"><a href="usercp.php$session[sessionurl_q]">$vbphrase[user_control_panel]</a></td></tr>
		<if condition="$show['siglink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editsignature">$vbphrase[edit_signature]</a></td></tr></if>
		<!--<if condition="$show['avatarlink']"><tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editavatar">$vbphrase[edit_avatar]</a></td></tr></if>-->
		<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editprofile">$vbphrase[edit_profile]</a></td></tr>
		<tr><td class="vbmenu_option"><a href="profile.php?$session[sessionurl]do=editoptions">$vbphrase[edit_options]</a></td></tr>
		
		<tr><td class="thead">$vbphrase[miscellaneous]</td></tr>
		<if condition="$show['pmstats']"><tr><td class="vbmenu_option"><a href="private.php$session[sessionurl_q]" rel="nofollow">$vbphrase[private_messages]</a></td></tr></if>
		<tr><td class="vbmenu_option"><a href="subscription.php$session[sessionurl_q]" rel="nofollow">$vbphrase[subscribed_threads]</a></td></tr>
		<tr><td class="vbmenu_option"><a href="member.php?$session[sessionurl]u=$bbuserinfo[userid]">$vbphrase[my_profile]</a></td></tr>
		<if condition="$show['wollink']"><tr><td class="vbmenu_option"><a href="online.php$session[sessionurl_q]">$vbphrase[whos_online]</a></td></tr></if>
		
		</table>
	</div>
	<!-- / user cp tools menu -->
	</if>
Place this below (after replacing "yoursite.com" with your website address):
HTML Code:
<if condition="is_member_of($bbuserinfo,5,6,7)"> 
<!-- Mod links menu--> 
<div class="vbmenu_popup" id="stafflinks_menu" style="display:none"> <table cellpadding="4" cellspacing="1" border="0"> 
<tr><td class="thead">Mod Links</td></tr> 
<if condition="is_member_of($bbuserinfo,6)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/admincp/index.php">Admin CP</a></td></tr></if> 
<if condition="is_member_of($bbuserinfo,5,6,7)"><tr><td class="vbmenu_option"><a href="http://www.yoursite.com/forum/modcp/index.php">Mod CP</a></td></tr></if> 
</table>
 </div> 
<!-- / staff links menu --> 
</if>
With this mods can only see the modCP, not the adminCP. I have put the Mod rules in mine, but left it out for you. Have fun.

Edit: do not mind the colors above. The automerge function of this site is causing this.

So, here is my new post:

I'd like to add a link to the staff links menu which shows moderators unread posts in their forums. How can I do that?
Reply With Quote
  #15  
Old 11-26-2006, 06:47 PM
Targowski Targowski is offline
 
Join Date: Sep 2006
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot, was just going to look for this on Google - haha.
Reply With Quote
  #16  
Old 01-07-2007, 05:42 PM
ngaiox ngaiox is offline
 
Join Date: Aug 2006
Posts: 12
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks! Many thanks!
Reply With Quote
  #17  
Old 07-03-2007, 07:58 PM
J0iN J0iN is offline
 
Join Date: Apr 2007
Posts: 10
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Really needed a drop down to show more links so it would fit on the page many thanks
Reply With Quote
  #18  
Old 07-22-2007, 05:18 PM
Alfa1's Avatar
Alfa1 Alfa1 is offline
 
Join Date: Dec 2005
Location: Netherlands
Posts: 3,537
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

In the 'User CP' drop down on the navbar here at vb.org, the top link is 'user control panel'. It is both dark blue, has bold white font and it is linked. What is the 'td class' value for this?
i.e. I currently have
Code:
<td class="vbmenu_option">
which makes it a grey drop down link with normal blue font, instead of a dark blue linked one.
Reply With Quote
  #19  
Old 12-12-2007, 11:42 AM
tunistunis tunistunis is offline
 
Join Date: Jun 2007
Posts: 33
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thx
Reply With Quote
  #20  
Old 02-09-2008, 12:53 PM
katilkuzu's Avatar
katilkuzu katilkuzu is offline
 
Join Date: Feb 2006
Location: Istanbul
Posts: 189
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

grat job dude. thanks alot
Reply With Quote
  #21  
Old 04-25-2009, 06:54 PM
Criminal-Minds Criminal-Minds is offline
 
Join Date: Feb 2009
Posts: 23
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

If i wanted to add multiple different Drop down boxes (i.e 2 separate boxs) How would I go about this?
Reply With Quote
Reply


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 05:37 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.09904 seconds
  • Memory Usage 2,353KB
  • Queries Executed 25 (?)
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
  • (1)bbcode_code
  • (10)bbcode_html
  • (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
  • (1)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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