PDA

View Full Version : is_member_of info


Trek
02-22-2009, 10:35 PM
First, if there's somewhere that lists vB functions, please point me in the right direction.

That being said, I'm trying to do something like this

if (is_member_of(3,5,6)) {
Do stuff
}

Basically, pass in the memberID that I want to check. Since this isn't the ID of the member online, but one I have stored in the DB. So I want to see if member ID 3, is in usergroups 5 or 6. Is this possible?

1Unreal
02-22-2009, 10:50 PM
http://www.vbulletin.com/docs/html/template_conditionals

<if condition="is_member_of($vbulletin->userinfo, 3, 5, 6)">
Do stuff
</if>

Lynne
02-22-2009, 11:02 PM
And to see more than you ever thought you would want to see, the vB API - http://members.vbulletin.com/api/

Post 2 is for templates. For plugins:

if (is_member_of($your_user_info, 3,5,6))
{
whatever
}

Trek
02-22-2009, 11:54 PM
This helped perfectly, thank you! Basically I used fetch_userinfo with the user number I had, then used that in the is_member_of function. Works great, thanks again!

Dismounted
02-24-2009, 04:52 AM
If you are using the current user, you don't need to use fetch_userinfo(). (If otherwise, that's fine. :p)

Trek
02-24-2009, 09:58 PM
If you are using the current user, you don't need to use fetch_userinfo(). (If otherwise, that's fine. :p)

Yup, using other users. Basically I made a quick mod that goes through a custom user profile field (SMS Address) and then text's anyone that has filled it out and is in the proper user groups.

So the check was to make sure each user that has that field filled out, is in the user group I allow to get text messages from the website.

The only odd thing is, the person that sends the message, never gets text'd, everyone else does though.

Dismounted
02-25-2009, 06:33 AM
It looks like your dealing with multiple users (and hence multiple calls to fetch_userinfo). In this case, you probably want to run a query that fetches all the users at once (fetch_userinfo() will run one query every time it is called).