Log in

View Full Version : "If condition "member of usergroup"


AzH
01-04-2009, 02:26 PM
Hi,

I forget how to do this. What is the if code for displaying only to a certain usergroup?

Thanks.....

UKBusinessLive
01-04-2009, 02:51 PM
Is it this ...

<if condition="!is_member_of($bbuserinfo,5,6,7)">

Thats off the top of my head, Lynne is the one that should know ;)

ry215
01-04-2009, 03:50 PM
Hi,

I forget how to do this. What is the if code for displaying only to a certain usergroup?


Thanks.....

try this :)

<if condition="in_array($bbuserinfo[usergroupid], array(1,2,3))">
show
<else />
don't show
</if>

Kirk Y
01-04-2009, 04:51 PM
UKBusiness's is the correct one (though the ! in front of it will display for members who are not in groups 5, 6, or 7.

ry215's code will not take Secondary Usergroups into account.

Keep in mind as well, $bbuserinfo may not always be correct in every instance. For example, if you're using the code in the postbit template, you would use $post; in the memberinfo template, you would use $userinfo.

Dismounted
01-05-2009, 02:47 AM
in the memberinfo template, you would use $userinfo.
Or $prepared in that "group" of templates as well.