PDA

View Full Version : Usergroup check in plugin


Davey-UK
04-05-2012, 06:48 AM
Hopefully you will be able to understand my needs here. I will try to explain the best i can.

I have the following piece of code in a plugin i am trying to work with:
$schbot = ($vbulletin->superglobal_size['_COOKIE'] == 0 AND preg_match("#(google|msnbot)#si", $_SERVER['HTTP_USER_AGENT']));

// check if user is in a certain usergroup and if system is enabled
if ($show['guest'] AND !$schbot AND $vbulletin->options['schison'])

The part highlighted in red is the bit i need to modify. I want it to check if the user is in a certain usergroup (2).

I have read about the conditionals, and got the following:
is_member_of($bbuserinfo, 2)
But if i simply exchange one for the other, as below, it doesnt work.
$schbot = ($vbulletin->superglobal_size['_COOKIE'] == 0 AND preg_match("#(google|msnbot)#si", $_SERVER['HTTP_USER_AGENT']));

// check if user is in a certain usergroup and if system is enabled
if (is_member_of($bbuserinfo, 2) AND !$schbot AND $vbulletin->options['schison'])
Can someone point me in the right direction, before i pull my hair out! Please. :)

Basically the code is making sure i am not from google or msn, and if i am in usergroup 2 it will fire a message.

kh99
04-05-2012, 07:37 AM
You didn't say which hook you're using so I'm not sure, but try:

is_member_of($vbulletin->userinfo, 2)

Davey-UK
04-05-2012, 07:57 AM
You've only gone and done it first shot!
Thankyou so much. I'm sure i will be back for more info. :)
Thanks again:up: