MyBB Community Forums

Full Version: Not validating both groups despite correct syntax.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
The first line.
Yes, both condition matches, hence why only the code is executed. The condition for second if line (primary and additional group checks) is such that if I check additional group first like:

if(!in_array($mybb->user['additionalgroups'], $groups) || !in_array($mybb->user['usergroup'], $groups) && $var >= $var2)

And if the user has the additional group as specified in settings, it works. But if it's not the additional group, it stops there (or condition isn't evaluated or checked) and doesn't check for primary group.

Similar is with checking primary group first and then additional, it stops there. Basically it acts like AND condition whereas it has to move further and check for that OR condition as well.
For the additional groups check, you will need something like this:
http://community.mybb.com/thread-124348-...#pid898782

Plugin Library does offer a similar function is_member().
I'd need to use something this big for a small thing like this? Because I thought this should be as simple as exploding an array, never used additional groups so I am not sure of it.
You can write your own function or adapt mine to your needs. You don't even need a function TBH but those are meant to save you time and avoid repeated code.
Pages: 1 2