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

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
  #2  
Old 09-15-2006, 03:28 AM
TroyF2000's Avatar
TroyF2000 TroyF2000 is offline
 
Join Date: Aug 2006
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

COOL! I can get some use out of this! I like the idea of making me and my administrator the only ones who can see the "hidden" RPG link. heheh. Thanks for the script, JK!

PS: Say, you don't know how to embed a new font to your forum, do you? I'm sure it's some easy thing already included as an option somewhere in the panel, but I'm an idiot and can't find it.
Reply With Quote
  #3  
Old 09-15-2006, 04:28 AM
JenniferK JenniferK is offline
 
Join Date: Dec 2005
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm glad you can use it

As for the font, off the top of my head I don't remember exactly, but I know in Admin CP you want to go into Styles and Templates and then Style Manager
Reply With Quote
  #4  
Old 09-17-2006, 08:17 PM
Princeton's Avatar
Princeton Princeton is offline
 
Join Date: Nov 2001
Location: Vineland, NJ
Posts: 6,693
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

great article ... thanks for sharing with the community :up:
Reply With Quote
  #5  
Old 10-14-2006, 08:26 PM
HPIA HPIA is offline
 
Join Date: Jul 2006
Posts: 196
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Aww, it didn't work. I got an error that said an </if> tag was mising on line 151. How do I find line 151 and add an </if> tag? Should I post my code up?

What is the 5,6,7 thing for?

[/noob]
Reply With Quote
  #6  
Old 10-20-2006, 06:16 PM
JenniferK JenniferK is offline
 
Join Date: Dec 2005
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'm thinking when you copied and pasted the code, you didn't grab the whole thing, leaving one of the </if> tags off of the end.

The 5,6,7 is for the conditional of who you want the menu to display to. You would need to edit that for your own board - for example, include 5, 6 and 7 if those are the usergroup id numbers for the usergroups you want the menu to display for.
Reply With Quote
  #7  
Old 10-24-2006, 11:19 AM
gamesmastervide gamesmastervide is offline
 
Join Date: Sep 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

anyway to get this working in postbit?
Reply With Quote
  #8  
Old 10-24-2006, 05:04 PM
Sergio68's Avatar
Sergio68 Sergio68 is offline
 
Join Date: Nov 2001
Location: Italy
Posts: 100
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by JenniferK
I'm thinking when you copied and pasted the code, you didn't grab the whole thing, leaving one of the </if> tags off of the end.

The 5,6,7 is for the conditional of who you want the menu to display to. You would need to edit that for your own board - for example, include 5, 6 and 7 if those are the usergroup id numbers for the usergroups you want the menu to display for.
Sorry JenniferK but you did this probably

Instead of this :

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 -->
Use this :

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>
And everything works fine
Reply With Quote
  #9  
Old 10-26-2006, 12:58 PM
Luggruff's Avatar
Luggruff Luggruff is offline
 
Join Date: Apr 2005
Posts: 239
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

could you change the is_member_of to select userID instead?

Currently I'm using this:

Code:
<if condition="in_array($bbuserinfo['usergroupid'], array(5,6,7,50))">
</if>
though that only checks for primary usergroup..

And I'm using this for useriD.. though it will get confusing having two different types of code to sort out userID's and usergroupID's

Code:
<if condition="in_array($bbuserinfo['userid'], array(5,6,7,50))">
</if>
Reply With Quote
  #10  
Old 10-28-2006, 06:28 PM
JenniferK JenniferK is offline
 
Join Date: Dec 2005
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

hmmm, honestly I don't know enough to answer your question, maybe someone else can help?
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 04:45 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.04418 seconds
  • Memory Usage 2,324KB
  • Queries Executed 23 (?)
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
  • (4)bbcode_code
  • (4)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
  • (1)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