Jump to content

Check if a user is in a certain group or secondary group


TimeTester

Recommended Posts

Posted

Again, thank you - I have managed to successfully determine if a user is in a secondary group or not. Here is what I used in the end:

 

{{$member = \IPS\Member::loggedIn();}}
{{$group_array = explode(",", $member->mgroup_others);}}
{{if in_array(10,$group_array)}}
YES IM IN THE SECONDARY GROUP!!!
{{else}}
NO! I'm not in the secondary group!!!
{{endif}}

Posted

You could shorten that to

{{if in_array( 10, explode( ',', \IPS\Member::loggedIn()->mgroup_others ) )}}
YES IM IN THE SECONDARY GROUP!!!
{{else}}
NO! I'm not in the secondary group!!!
{{endif}} 

 

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...