PDA

View Full Version : php file editing for usergroups


viper357
01-15-2013, 11:28 AM
Hi everyone, simple question :p I'm on 3.8.5

I'm wanting to edit a line in a .php file
if ($vbulletin->userinfo['usergroupid'] == '6')

Now if I want to add an additional usergroup in there, is it a simple matter of adding a comma, like this?

if ($vbulletin->userinfo['usergroupid'] == '5,6')

Thanks.

kh99
01-15-2013, 11:40 AM
You would have to do another check, combined with an OR, like:

if ($vbulletin->userinfo['usergroupid'] == 5 OR $vbulletin->userinfo['usergroupid'] == 6)


You can also use an array, if you have more than two (or if you just prefer how it looks)
if (in_array($vbulletin->userinfo['usergroupid'], array(5, 6)))


There's also a vbulletin function for checking if a user is a member of a group:
if (is_member_of($vbulletin->userinfo, 5, 6))


But that does something a little different, because it checks for additional groups as well as the main usergroupid.

Sorry if this is confusing - the first one is fine. :)

viper357
01-15-2013, 12:42 PM
Perfect, thank you very much. :)