The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
plugin conditional help
I can't figure out how to put a usergroup conditional to show a link to just admin in this plugin that adds nav links in my PP Gallery....I tried a few but none worked.
Any Ideas? Code:
global $template_hook; $tabselected = ''; $tablinks = ''; if (PP_SCRIPT == 'PP_Pro') { $vbulletin->options['selectednavtab']='pp_pro'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li><a href="http://www.mysite.com/gallery/index.php">Gallery Home</a></li> <li><a href="http://www.mysite.com/gallery/showgallery.php?cat=500&ppuser=$vbuserid">My Photos</a></li> <li><a href="http://www.mysite.com/gallery/search.php?what=fav">My Favorites</a></li> <li><a href="http://www.mysite.com/gallery/useralbums.php">My Albums</a></li> <li><a href="http://www.mysite.com/gallery/uploadphoto.php">Upload Photos</a></li> <li><a href="http://www.mysite.com/gallery/search.php">Search</a></li> I WANT TO ADD CONDITIONAL HERE <li>LINK FOR ADMINS</li> END CONDITIONAL </ul> '; } $template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.mysite.com/gallery/">Gallery</a>'.$tablinks.'</li>'; |
#2
|
|||
|
|||
If think you'd want:
Code:
if (is_member_of($vbulletin->userinfo, 6)) { // admins only } You may also need to declare $vbulletin as global. |
#3
|
|||
|
|||
How do I declare $vbulletin as global??
|
#4
|
|||
|
|||
Just add it to your first line, like: Code:
global $template_hook, $vbulletin; |
#5
|
|||
|
|||
Code:
global $template_hook, $vbulletin; $tabselected = ''; $tablinks = ''; if (PP_SCRIPT == 'PP_Pro') { $vbulletin->options['selectednavtab']='pp_pro'; $tabselected = ' class="selected"'; $tablinks = ' <ul class="floatcontainer"> <li><a href="http://www.mysite.com/gallery/index.php">Gallery Home</a></li> <li><a href="http://www.mysite.com/gallery/showgallery.php?cat=500&ppuser=$vbuserid">My Photos</a></li> <li><a href="http://www.mysite.com/gallery/search.php?what=fav">My Favorites</a></li> <li><a href="http://www.mysite.com/gallery/useralbums.php">My Albums</a></li> <li><a href="http://www.mysite.com/gallery/uploadphoto.php">Upload Photos</a></li> <li><a href="http://www.mysite.com/gallery/search.php">Search</a></li> if (is_member_of($vbulletin->userinfo, 6)) { <li> link here </li> } </ul> '; } $template_hook['navtab_middle'] .= '<li'.$tabselected.'><a class="navtab" href="http://www.mysite.com/gallery/">Gallery</a>'.$tablinks.'</li>'; Hmmm, I tried the code above, but no luck.. It just shows the conditional text and link. Im using global_state_check as the hook location, if that helps. |
#6
|
|||
|
|||
You put it in the middle of the string. You need to do something like this:
PHP Code:
|
Благодарность от: | ||
tommyxv |
#7
|
|||
|
|||
That made the plugin to stop working. Any more ideas? Thanks for the help BTW.
|
#8
|
|||
|
|||
Hmm...I don't see anything wrong with it. Try temporarily removing the 4 lines starting with the 'if' and see if the plugin works (without the admin link of course).
edit: or comment them out like this: PHP Code:
|
#9
|
|||
|
|||
I'll try that...
I noticed that the dot is missing for some of the tablinks... Code:
$tablinks .= |
#10
|
|||
|
|||
The dot means you're adding to the string instead of setting it, so it should only be on some one them.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|