Replacing $user_info with $context in groups

Started by Daretary, March 20, 2023, 03:27:32 AM

Previous topic - Next topic


I do not want to register a variable in the global once again.

Will the replacement work
in_array(1, $user_info['groups']to
in_array(1, $context['user']['groups'])


If you don't want to register another global (and I don't know why not, it's harmless in this context), I suggest:

in_array(1, $GLOBALS['user_info']['groups'])
The two are not quite interchangeable. Depending on exactly where you're doing this it may not be accurate to use $context.