The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Action based on condition
Can someone tell me how to exclude an action (or line(s)) in a vBulletin script page such as in index.php by allowing only a paricular user or administrator ?
For example...... <if $Username="Administrator"> This is the line I want to be conditionally executed </if> In the above example, I ONLY want the red line to be executed if the user is Administrator. I need some way to exclude a line of the script UNLESS it's the administrator(s) or a particular members who IS the adminstrator. What I don't know is what variables are stored in memory and how to use them in a conditional statement like this. Thanks |
#2
|
||||
|
||||
Are you using these in a PHP file or in a template?
If you're straight-up editing a PHP file, you might want to consider using vBulletin's Plugin System rather than directly modifying your Index.php file -- but, I'll show you anyway as it's the same concept in either option. PHP Code:
PHP Code:
|
#3
|
|||
|
|||
For some reason it's not working?
I'm working inside vbulletin's admin panel. Here's the actual code in the template.... <if ($vbulletin->userinfo['username']=='JohnDoe')> <td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td> </if> And here's what I get when I view the Source in a browser.... <if (Array['username']='JohnDoe')> <td class="vbmenu_control"><a href="memberlist.php">Members List</a></td> </if> But for some reason, it still shows the code no matter what. I'm baffled. If I comment out the code, it no longer shows (as expected). any ideas? Thanks |
#4
|
|||
|
|||
In vB templates do like this:
Code:
<if condition="$bbuserinfo[username] == 'JohnDoe'"> <td class="vbmenu_control"><a href="memberlist.php$session[sessionurl_q]">$vbphrase[members_list]</a></td> </if> |
#5
|
|||
|
|||
Thank calorie !!!!
It worked !!!!! HUG Thanks also for your help acidburn. For some reason I just could quite get it to work with the code you posted |
#6
|
||||
|
||||
The code I posted was for use in either PHP Files or Plugins, sorry I wasn't more specific.
|
#7
|
|||
|
|||
would I be able to use that in a template field in vbulletin 3.5?
|
#8
|
||||
|
||||
If you're using it in a template:
Code:
<if condition="is_member_of($bbuserinfo,1,2,3)"> Code to execute if User is a Member of Usergroups 1, 2, or 3 </if> |
#9
|
|||
|
|||
acidburn0520 you hit the nail right on the head!!!! thats what works!!!!
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|