View Full Version : What is the if condition= for group & logged in?
libertate
04-06-2006, 06:46 PM
I am trying to add a field to the postbit, and to show up only if the logged in user is within a specific group.
What is the <if condition="?????"></if> to see if user is in the group(s) and also logged in?
Paul M
04-06-2006, 06:55 PM
<if condition="is_member_of($posts,2)"> do something </if>Where 2 is the usergroupid.
libertate
04-07-2006, 01:08 PM
<if condition="is_member_of($posts,2)"> do something </if>Where 2 is the usergroupid.
Awesome. Thank you.
Last Q - vBulletin.vb_userfield.field1 (admin defined profile field) how do I reference it to display?
i.e.
<if condition="is_member_of($posts,2)"> display vb_userfield.field1 </if>
peterska2
04-07-2006, 01:30 PM
In the postbit$post[fieldx] where x is the field number.
Or in the memberinfo$userinfo[fieldx]
libertate
04-07-2006, 03:41 PM
Hmm...
...
<a class="bigusername" href="member.php?$session[sessionurl]u=$post[userid]">$post[musername]</a>
<if condition="is_member_of($posts,9)">$post[field8] </if>
$post[onlinestatus]...
I double checked that the user is in group 9, still nothing displays.
If I remove the conditional, the text is displayed without a problem.
What could I be doing wrong? Does the group have to be the primary group? Is there a "set" list, where I can define a set of groups?
(Is there a central reference to all this, so I don't have to bug all of you on this for the next 2 dozen issues?)
Freesteyelz
04-08-2006, 02:13 AM
I could be wrong but it looks like you're defining that if the user who posted is in Usergroup 9 then $post[field8] will show up. If yes, then anyone (logged in or not) will be able to view field8 for that particular post. It may explain why you didn't see field8.
If you want only Usergroup "9" to see "$post[field8]" then try:
<if condition="is_member_of($bbuserinfo, 9)">$post[field8]</if>
libertate
04-08-2006, 04:34 AM
Excellent! Works like a charm.
Thank you.
Where can I get some sort of a manual or details of these fields, functions, etc?
Freesteyelz
04-08-2006, 05:51 AM
NP. :)
Aside from vBulletin's manual I've gathered what I need from vBulletin.com. In the "How Do I..." and "Quick Tips & Custiomizations" forums you can get quite a bit of information by doing various searches. Also, a good tip is to study the vB's .php codes and various vB.org hacks as they often contain common routines. :)
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.