Not Solved PHP Conditionals
Not Solved
Im trying to do this in my templates while using the PHP plugin.

This Code Doesnt Work With The Variable
<if (strpos($GLOBALS['mybb']->user['additionalgroups'], "4") == true) then></if>

This Code Works Without The Variable
<if (strpos("5,7,1,4", "4") == true) then></if>

In the end im trying to get something that hides if a gid is found in a users additional groups, which is why im not using the simple "<if $GLOBALS['mybb']->user['usergroup'] == 1 then>".
If you dont know why this wont work, its because 9/10 times the additional groups will not contain a single number and will contain 5,7,3,6 for example.

Any ideas?
Not Solved
You need to explode each additional group and then run a loop through the array and find if the group is in there. I don't know exactly how you'd type this in a template but the idea is the same and this would work in a normal PHP plugin file:
$groups = explode(",", $mybb->user['additionalgroups']);
if(in_array("4", $groups))
    //TRUE -> run your code if they have additionalgroup of 4

Hope that helps!
My Plugins: [1.8]|[1.6]

** Selling custom plugin that enables Bitcoin payments. PM me if interested in purchasing! **
Not Solved
Thanks, i guess that would work but I got this answer from ZingaBurga
<if strpos(','.$GLOBALS['mybb']->user['additionalgroups'].',', ',4,') !== false then>
Which works, thanks

Forum Jump:

Users browsing this thread: 1 Guest(s)