View Full Version : checking usergroups
dethfire
03-10-2004, 11:34 PM
how do I check for a members usergroup, I want to make my ads only appear for certain usergroups
Xenon
03-10-2004, 11:40 PM
the is_member_of function may help ya :)
dethfire
03-26-2004, 02:06 AM
can I use that in a template?
like I want:
if (!is_member_of("gold"))
{
// display ads
}
Is that right?
Xenon
03-26-2004, 02:18 PM
yes you should be able to use it in a template.
but instead of the 'gold' you have to use the usergroupid of the usergroup
dethfire
03-27-2004, 06:39 PM
hmmm well, this did not work, I wanted the ads to show for every usergroup except group10
<if condition="!is_member_of($post, 10)">
so then I tried to set an array for the if to affect all usergroups besides 1o, still didn't work
<if condition="is_member_of($post, array(1, 2, 3, 9))">
how can I accomplish this?
deathemperor
03-28-2004, 08:51 AM
Xenon, how to check usergroups in template conditions ?
Xenon
03-28-2004, 11:02 AM
// ###################### Start is member of #######################
// returns true/false if a $userinfo belongs to $usergroupid
// $userinfo must contain (userid, usergroupid, membergroupids)
function is_member_of($userinfo, $usergroupid)
it's self explaining commented i think :)
deathemperor
03-28-2004, 11:33 AM
sorry for my bad but I still didn't understand how yet.
I actually want to check if usergroup id = 6 ( admin ), then it will display an image showing that user belong to admin group. Same for that to my Fan Club Group.
Xenon
03-28-2004, 03:49 PM
<if condition="is_member_of($post, specific id here)"><img....</if>
deathemperor
03-29-2004, 12:33 AM
kooool !
It worked !
Thank you so much Xenon !
Xenon
03-29-2004, 03:20 PM
:)
you're welcome
deathemperor
03-30-2004, 09:21 AM
erm
how about checking if someone's id is 202 (mean Xenon ^^) ?
Xenon
03-30-2004, 04:38 PM
then you've to use an condition $post[userid] == xx
deathemperor
03-31-2004, 01:06 AM
hmm, Wayne Luke has just showed me that I should use:
<if (in_array($bbuserinfo['usergroupid'], array (4,5,6)))>
deathemperor
03-31-2004, 01:22 AM
Thanks alot Xenon, yours works but not Wayne Luke's
and with an <else /> I'm getting more fun ^^
I've actually tried $post[userid] = xx, but yes, I miss one '=' >_<. darn, how could I be that bad
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.