Home › Forums › Front End PM PRO › Group Visibility (Role Restriction) In personal settings
- This topic has 6 replies, 2 voices, and was last updated 7 years, 3 months ago by Andrew Perryman.
- AuthorPosts
- September 5, 2018 at 6:22 pm #17246Andrew PerrymanParticipant
Hi Shamim,
Is there a way to restrict limit the visibility of a group thats been created so that a role can’t see it in their own personal settings?
The reason for this is that our team want to have a group setup for them that only they can see if they are all editor etc.
So do you already have a PHP hook or action / filter for this in you repository of snippets so I can create a group (like a DL) for only the team use and visibility if they have been set as a specific role?
Look forward to your update..
Andrew
September 5, 2018 at 8:45 pm #17254Shamim HasanKeymasterSo you want to restrict those groups so that only editor and administrator can see those group in user settings page, other users cannot see those groups in settings page (in front-end), right?
September 5, 2018 at 9:10 pm #17256Andrew PerrymanParticipantEvening Shamim,
Yes, but not restricting all groups only one or selected groups, otherwise it is as you have said so that I can create a group that will be listed in the person settings for Admin or Editors or contributors or what ever roles I choose only. So if I wanted to exclude subscribers or any other role I could for one or more specific groups.
This then means when a new admin ,editor or contributor comes on board only they will see the extra groups listed in their settings amongst all the other pre created groups listed but not the standard members (users / subscribers role).
Hope that clarify’s the situation.
For clarification I have added two attachments for what I mean below, one as an Admin or designated roles and one as subscriber who will not see the group called management in their settings options.
Andrew.
Attachments:You must be logged in to view attached files.September 5, 2018 at 9:12 pm #17261Andrew PerrymanParticipantPS.. Oh and yes, for got to add only for the front-end..
Andrew
September 5, 2018 at 9:23 pm #17264Andrew PerrymanParticipantOh, sorry one more thing…
Just thought this would need to take effect in the users WP profile as I have just remembered that you give the option in the users WP profile to allow the them to add themselves to each group listed in that area too.
Hope that makes sense..
Andrew
September 5, 2018 at 10:26 pm #17270Shamim HasanKeymasterAdd following code in your theme’s (child theme’s if any) functions.php
add_filter( 'fep_get_option', function( $value, $option, $default, $is_default ) { if ( 'gm_groups' !== $option ) { return $value; } if ( is_admin() && 'users' !== @get_current_screen()->parent_base ) { return $value; } if ( ! is_admin() && 'settings' !== @$_GET['fepaction'] ) { return $value; } // Change this with which role you want to give access to all groups $allowed_roles = array( 'editor', 'administrator' ); if ( array_intersect( $allowed_roles, wp_get_current_user()->roles ) ) { return $value; } // Change this with your desire groups slug $groups = array( 'test1', 'test2' ); foreach ( $groups as $group ) { unset( $value[ $group ] ); } return $value; }, 10, 4 );Change roles and groups as required
September 6, 2018 at 3:10 am #17281Andrew PerrymanParticipantShamim….. You Star.
It works in all ways it hides all management groups from unauthorised roles..in the FEPM settings and in the Dashboard WP profile too unless force added which is even better than I expected.
Fantastic.. You Rock dude..
Andrew.. 🙂
- AuthorPosts
You need to purchase ‘Front End PM PRO’ to create topic in this support forum.
If you already purchased ‘Front End PM PRO’ please LOGIN.