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

Reply
 
Thread Tools
vB4.2 Navigation Manager - how to discussion
AusPhotography's Avatar
AusPhotography
Join Date: Nov 2007
Posts: 521

 

Hobart & Adelaide .au
Show Printable Version Email this Page Subscription
AusPhotography AusPhotography is offline 05-18-2012, 10:00 PM

I have vB 4.2.0 BETA 1 running in my test system.

Products that use templates/hooks to integrate with the navbar will need the following changes to work with the Navigation Manager.

Please post code snips and hints in this thread, we are all on a learning curve.

1. Remove old style navigation hooks/templates etc.

2. Create a new <navigation> section in the product XML file
(You can create the navigation in the navigation manager, linked to a product then export the product file as a skeleton)

3. Set any conditionals in a hook or in your main code
Eg. $show['apmgtug'] = true; is set for one of the menu items in my example
My example relies on $show['member'] = true; as well.
Leave the <show> tag empty for 'public' tabs/links

4. If you have multiple scripts, leave <scripts> blank and set $root at the new hooks set_navigation_tab_fallaback or set_navigation_tab_vbview

Code:
if (<some condition>) $root= '<name of tab>';
I hope that helps you get a quick leg up for this change.

I would probably have a new vB4.2 code base because of the differences, you could have the same code base with some sort of version check.

In the end the new navigation integration is better and easier.

Here are sample <navigation> from one of my own plugins...

Code:
	<navigation>
		<tab name="aptab_competition" date="1337135420" username="APcompetition" version="3.0.0">
			<active>1</active>
			<show>member</show>
			<scripts>apcompetition</scripts>
			<displayorder>30</displayorder>
			<url><![CDATA[apcompetition.php{session.sessionurl_q}]]></url>
		</tab>
		<link name="aplink_enter" date="1337135420" username="APcompetition" version="3.0.0">
			<active>1</active>
			<show>member</show>
			<parent>aptab_competition</parent>
			<displayorder>20</displayorder>
			<url><![CDATA[apcompetition.php{session.sessionurl_q}]]></url>
		</link>
		<link name="aplink_search" date="1337135420" username="APcompetition" version="3.0.0">
			<active>1</active>
			<show>member</show>
			<parent>aptab_competition</parent>
			<displayorder>40</displayorder>
			<url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=search&apmycomps=1]]></url>
		</link>
		<link name="aplink_performance" date="1337135420" username="APcompetition" version="3.0.0">
			<active>1</active>
			<show>member</show>
			<parent>aptab_competition</parent>
			<displayorder>60</displayorder>
			<url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=performance]]></url>
		</link>
		<link name="aplink_fame" date="1337135420" username="APcompetition" version="3.0.0">
			<active>1</active>
			<show>apmgtug</show>
			<parent>aptab_competition</parent>
			<displayorder>80</displayorder>
			<url><![CDATA[apcompetition.php?{vb:raw session.sessionurl}do=finalvotereport]]></url>
		</link>
	</navigation>
Sample phrases the give the text of the navigation items.
Code:
		<phrasetype name="GLOBAL" fieldname="global">
			<phrase name="vb_navigation_tab_aptab_competition_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Competitions]]></phrase>
			<phrase name="vb_navigation_link_aplink_enter_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Enter a Competition]]></phrase>
			<phrase name="vb_navigation_link_aplink_search_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Search Competitions]]></phrase>
			<phrase name="vb_navigation_link_aplink_performance_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[My Performance]]></phrase>
			<phrase name="vb_navigation_link_aplink_fame_text" date="1336964077" username="APcompetition" version="3.0.0"><![CDATA[Hall of Fame]]></phrase>
		</phrasetype>
--------------- Added [DATE]1337391078[/DATE] at [TIME]1337391078[/TIME] ---------------

Pull down menu's can also be coded.
Have a look at the vB source for examples.
Specifically "./install/vbulletin-navigation.xml"
Reply With Quote
  #92  
Old 05-29-2012, 09:22 PM
Andreas's Avatar
Andreas Andreas is offline
 
Join Date: Jan 2004
Location: Germany
Posts: 6,863
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Altari View Post
Awww that works perfectly, thank you !
For guys who read : Add an id...
... a unique ID or you will run into problems sooner or later
Reply With Quote
  #93  
Old 05-30-2012, 03:51 AM
Badshah93 Badshah93 is offline
 
Join Date: Jun 2010
Location: India
Posts: 505
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Andreas View Post
... a unique ID or you will run into problems sooner or later
chances are very less, because all the links inside menu generated through navigation manager has id in range of (20 - 50 +), so one can use any id between 1-20 for links inside menu. (per menu).

A higher number will be much better (ex: 1001)

OR

Get the last navid of link in menu.

PHP Code:
$lastnavid array_pop(array_keys($result['vbtab_forum']['links']['vbmenu_qlinks']['links']));
$lastnavid $result['vbtab_forum']['links']['vbmenu_qlinks']['links'][$lastnavid]['navid']; 
So, last code which i gave to one of the user will be like this

PHP Code:
if (vB::$vbulletin->userinfo['userid'])  

$userid vB::$vbulletin->userinfo['userid']; 
$lastnavid array_pop(array_keys($result['vbtab_forum']['links']['vbmenu_qlinks']['links']));
$lastnavid $result['vbtab_forum']['links']['vbmenu_qlinks']['links'][$lastnavid]['navid'];

$lien_messujets = array(   
        
'name' => 'rescue_messujets',   
        
'navtype' => 'link',   
        
'url' => '{options.toppath}search.php?do=finduser&userid='.$userid.'&starteronly=1&contenttype=vBForum_Thread',  
        
'active' => 1,   
        
'text' => 'Mes sujets'
        
'productid' => 'vbulletin',
        
'navid' => $lastnavid++   
    );   
$lien_mesmessages = array(  
    
'name' => 'rescue_mesmessages',  
    
'navtype' => 'link',  
    
'url' => '{options.toppath}search.php?do=finduser&userid='.$userid.'&starteronly=1&contenttype=vBForum_Post&showposts=1',
    
'active' => 1,  
    
'productid' => 'vbulletin',  
    
'text' => 'Mes messages',
    
'navid' => $lastnavid++ 
);  
$lien_mesannonces = array(  
    
'name' => 'rescue_commu_annonces',  
    
'navtype' => 'link',  
    
'url' => '{options.toppath}member.php?u='.$userid.'&tab=afficher_annonces'
    
'active' => 1,  
    
'productid' => 'vbulletin',  
    
'text' => 'Mes annonces',
    
'navid' => $lastnavid++  
);  
     
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_messujets'] = $lien_messujets
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_commu_annonces'] = $lien_mesannonces
$result['vbtab_forum']['links']['vbmenu_qlinks']['links']['rescue_mesmessages'] = $lien_mesmessages
unset(
$userid); 

Reply With Quote
  #94  
Old 05-30-2012, 06:09 PM
Omegatron Omegatron is offline
 
Join Date: Feb 2003
Posts: 38
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

What I need to know is how to use the $vbulletin options in a url in the navigation manager
Reply With Quote
  #95  
Old 05-30-2012, 09:14 PM
Paul M's Avatar
Paul M Paul M is offline
 
Join Date: Sep 2004
Location: Nottingham, UK
Posts: 23,748
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

{options.optionname}
Reply With Quote
  #96  
Old 05-30-2012, 10:31 PM
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Location: Hobart & Adelaide .au
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Paul M View Post
{options.optionname}
Can we have a Article outlining what objects are available ?
I know of...
  • {options.__}
  • {session.__}
  • {userinfo.__}
What else is available?
Can we have custom objects?

Thanks!

Kym

Edit: Found the answer in the code.
See: function process_navigation_linkvars($url) in ./includes/functions.php
Anything in $GLOBALS or in $vbulletin->object where object is options, userinfo etc.
Reply With Quote
  #97  
Old 05-31-2012, 10:47 AM
Merenguista's Avatar
Merenguista Merenguista is offline
 
Join Date: Sep 2010
Location: Morocco
Posts: 70
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1- I want add a new Tab, what shoup i put in Tab Script(s) ?

2- I want add a menu and link only for Users Awaiting Moderation, what shoud i put in Show Permission Name ?
Reply With Quote
  #98  
Old 06-01-2012, 03:00 AM
AusPhotography's Avatar
AusPhotography AusPhotography is offline
 
Join Date: Nov 2007
Location: Hobart & Adelaide .au
Posts: 521
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

We use Photopost vBgallery and it runs in a different root path to the forum...
eg: ./forurm vs ./gallery
As a result any relative paths in the Tabs fail when in the Gallery unless you do some edits in the Navigation Manager.

I've built an interim product file for vBgallery 3.01 that has support for the new vB4.2.0 navigation. (I can't post it due to (c) reasons).

Chuck @ Photopost has my code and will release an update for vBgallery (soon-ish I hope)
Reply With Quote
  #99  
Old 06-01-2012, 08:20 AM
nhawk nhawk is offline
 
Join Date: Jan 2011
Posts: 1,604
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Merenguista View Post
1- I want add a new Tab, what shoup i put in Tab Script(s) ?
The name of the php script that makes the tab the active tab. The script must supply it's name with this code...

Code:
define('THIS_SCRIPT', 'thenameofthescript');
Quote:
Originally Posted by Merenguista View Post
2- I want add a menu and link only for Users Awaiting Moderation, what shoud i put in Show Permission Name ?
I don't think there's a standard $show variable for that usergroup so you would need to create a custom one in a plugin. Call it something like... uamod ...and put that in the Show Permission Name. The create a plugin with this code...

Code:
if(is_member_of($vbulletin->userinfo,3))
{
	$show['uamod'] = true;
}
That code can be used in either the 'parse_templates' or the 'process_templates_complete' hook.
Reply With Quote
  #100  
Old 07-06-2012, 08:39 PM
cjwinternet cjwinternet is offline
 
Join Date: Oct 2005
Posts: 77
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<removed>
Reply With Quote
  #101  
Old 07-21-2012, 01:12 AM
KGodel's Avatar
KGodel KGodel is offline
 
Join Date: May 2011
Location: Indiana
Posts: 332
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hey guys. I am having an issue with some Show Permissions. I have successfully gotten some working, creating the hook for each special usergroup, however when I add them together, so say I want usergroups X, Y, and Z to see a link, each having a separate $show variable in the hook I have created, when I combine them such as "showx.showy.showz" this seems to make the link appear only if a user is in ALL groups. Is there a character I am supposed to use aside from the dot to create an "or" combination versus and "and" combination? Thanks!
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 11:29 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04750 seconds
  • Memory Usage 2,356KB
  • Queries Executed 26 (?)
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
  • (5)bbcode_code
  • (2)bbcode_php
  • (5)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
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (4)post_thanks_box_bit
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit
  • (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
  • fetch_musername
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • post_thanks_function_fetch_thanks_bit_start
  • post_thanks_function_show_thanks_date_start
  • post_thanks_function_show_thanks_date_end
  • post_thanks_function_fetch_thanks_bit_end
  • post_thanks_function_fetch_post_thanks_template_start
  • post_thanks_function_fetch_post_thanks_template_end
  • 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