TimeTester Posted April 4, 2016 Share Posted April 4, 2016 I have created a page in Pages and was wondering if there is a way of checking if a visitor to that page is in a particular group? Thanks in advance Link to comment Share on other sites More sharing options...
Nathan Explosion Posted April 4, 2016 Share Posted April 4, 2016 Link to comment Share on other sites More sharing options...
Adriano Faria Posted April 4, 2016 Share Posted April 4, 2016 {{if \IPS\Member::loggedIn()->inGroup(array(4, 10))}} Link to comment Share on other sites More sharing options...
Tom Irons Posted April 5, 2016 Share Posted April 5, 2016 You can also simplify it even more and just do this: {{if member.inGroup( [ 4, 6 ] )}} Link to comment Share on other sites More sharing options...
TimeTester Posted April 5, 2016 Author Share Posted April 5, 2016 Thanks guys all three answers have put me on the right track Link to comment Share on other sites More sharing options...
TimeTester Posted April 5, 2016 Author Share Posted April 5, 2016 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}} Link to comment Share on other sites More sharing options...
bfarber Posted April 8, 2016 Share Posted April 8, 2016 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}} Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.