View Full Version : correct syntax for this please
lasto
01-17-2008, 08:04 PM
i have this code which is listed below.
if ($vbulletin->userinfo['userid'] != $info['userid'] AND $vbulletin->options['KarmaEditable'] && $vbulletin->userinfo['usergroupid'] != 5)
at moment its set for one usergroup how can i change the code to allow 2 usergroups as changing 5 at end to 5,6 simply wont work.
Opserty
01-17-2008, 08:33 PM
if (
($vbulletin->userinfo['userid'] != $info['userid'])
&&
($vbulletin->options['KarmaEditable'])
&&
(!is_member_of($vbulletin->userinfo, 5, 6))
)
(Just split it over 3 lines so its easier to read, you can condense it when you use it)
You can use in_array() to but the is_member_of function is better if your using vBulletin.
lasto
01-17-2008, 08:45 PM
cheers m8 much appreciated
--------------- Added 1200610468 at 1200610468 ---------------
sorry m8 the code in the 1st post works fine but code in second does not.Can u make the syntax correct for the 1st post please as i noticed that is_member_of is different in 1st post to the code u actually printed
Lynne
01-17-2008, 09:29 PM
Try this with array added in:
if (
($vbulletin->userinfo['userid'] != $info['userid'])
&&
($vbulletin->options['KarmaEditable'])
&&
(!is_member_of($vbulletin->userinfo,array(5,6)))
)
lasto
01-18-2008, 03:16 PM
nope that never seemed to work.Im on vbull 3.5.7 and its calling the code from a php file so dont think can change the actual code in post 1 around.
Is there no way to add 2 usergoups into the same code which i have in post 1
Opserty
01-18-2008, 03:24 PM
Hmm maybe is_member_of() has been added more recently then.
Use this is its place then:
(!in_array($vbulletin->userinfo['usergroupid'] , array(5, 6)))
P.S. Lynne, you can overload the is_member_of() function to check the userinfo against multiple usergroups.
Lynne
01-18-2008, 03:24 PM
nope that never seemed to work.Im on vbull 3.5.7 and its calling the code from a php file so dont think can change the actual code in post 1 around.
Is there no way to add 2 usergoups into the same code which i have in post 1
Well, I suppose you could go:
if ($vbulletin->userinfo['userid'] != $info['userid'] AND $vbulletin->options['KarmaEditable'] && ($vbulletin->userinfo['usergroupid'] != 5 OR $vbulletin->userinfo['usergroupid'] != 6))
lasto
01-18-2008, 08:22 PM
cheers lynne that worked fine.Appreciate your time and help on this.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.