The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
If conditional help
Hi,
I'm tryign to write an if conditional in the Member info template which will display information to a user if it's thier profile page and to all admins. I can work out the user conditional with this: <if condition="$bbuserinfo[userid] == $userinfo[userid]"> Stuff </if> But I can't figure out how to add the condistion that if the browser is an admin they see the information as well. I know I can use <if condition="$bbuserinfo[usergroup] == 6"> Stuff </if> To display to admins. But how do I get both conditionals to work for the same information. Currently admins get shut out becasue they don't meet the first condition or users get shut out because they don't meet the second condition. Any help would be greatly appreciate. Thanks. |
#2
|
||||
|
||||
Try...
Code:
<if condition="!is_member_of($bbuserinfo, 2) AND !is_member_of($bbuserinfo, 6) "> <!-- Content :) --> <!-- /Content --> </if> |
#3
|
|||
|
|||
Thanks for the suggestions Jonathan.
Sorry, that won't work. (yes I caught the typo in "condition" too) What I want is to display information to $bbuserinfo[userid] == $userinfo[userid] and $bbuserinfo[usergroup] == 6 only. The statement you've written appears like it would only show information if a user was a member of usergroup 2 and usergroup 6. I don't have any admins that are also in the registered users usergroup. In addition I have users that aren't in usergroup 2 and I need the information to only display to the single user, not all members of a usergroup. <if condition="$bbuserinfo[userid] == $userinfo[userid]"> works for the single users I just need to add the ability for admins to see this too. Since my super admins are users 1 and 2 I can set this: <if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[userid] < 3)"> And it works. I just can't seem to set the admin usergroup and make it work. At any rate, it's not working. Anyone with any other suggestions? |
#4
|
||||
|
||||
What typo? I see no typo!? (Thanks for the catch)
You need to adjust the numbers I gave you and it'll work. You can add more also to that by just adding more AND's... I don't see why this wouldn't work. Anyways, you should ask this over at vb.org |
#5
|
|||
|
|||
It doesn't work Jonathan. And again... I don't want to call usergroups other than the admin usergroup. I want to use a single userid and the admin usergroup. In any case it would need to be OR instead of AND because no one is going to be a member of both usergroups.
I've got it patched with <if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[userid] < 3)"> for now. But if anyone knows how to replace $bbuserinfo[userid] < 3 with $bbuserinfo[usergroup] == 6, I'd appreciate it. |
#6
|
|||
|
|||
That should work, actually.
Let me go and look in my code and see if I can supply you with the necessary code. HoC |
#7
|
|||
|
|||
Yep, why are you using is_member_of ??
Try this Code:
<if condition="$bbuserinfo['usergroupid'] == '6'"> your code here </if> |
#8
|
||||
|
||||
Alright well it worked for my needs at my boards, so okay. You're still better off at vb.org
|
#9
|
|||
|
|||
It's a template mod. It doesn't belong at vb.org.
And yeah $bbuserinfo[usergroup]== 6 does work by itself. But <if condition="($bbuserinfo[userid] == $userinfo[userid]) or ($bbuserinfo[usergroup] == 6)">Stuff</if> won't work when they are in the same conditional. |
#10
|
|||
|
|||
I got it sorted. I had a couple characters missing.
<if condition="($bbuserinfo[userid] == $userinfo[userid]) || ($bbuserinfo[usergroupid] == 6)">Stuff</if> Works |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|