![]() |
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 |
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:
|
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 |
In vB templates do like this:
Code:
<if condition="$bbuserinfo[username] == 'JohnDoe'"> |
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 :confused: |
The code I posted was for use in either PHP Files or Plugins, sorry I wasn't more specific.
|
Quote:
|
If you're using it in a template:
Code:
<if condition="is_member_of($bbuserinfo,1,2,3)"> |
acidburn0520 you hit the nail right on the head!!!! thats what works!!!!
|
All times are GMT. The time now is 08:59 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|