Custom User Role to approve user
-
Hi,
I have a multisite installation and only super admins are able to approve new users. I can’t make them superadmin just for this purpose. How can I make a custom user role for this?
-
Hi @june01
Have you tried approving users when you visit their profile? See the gear icon and then click on the “Approve Membership”. The user that will approve a membership should have the permission “Can edit other member accounts?” in the UM User Role settings.
Regards,
I’ve created a new user role called User Manager. This user should be able to manage subscribers only which includes approve/reject/delete/edit and view. I’ve set all required permissions in UM User Role settings but still not working. I can’t manage the users and view them.
I want to approve users using the member directory in front end.
Hi @june01
How many roles are assigned to your test account? Could you please provide a screenshot of the User Role( User Manager ) Settings? Please go to WP Admin > Ultimate Member > User Role > Edit “User Manager” role. You can upload the screenshot via imgur.com and then share the image URL here so we can review it.
Regards,
Only one user is assigned the role User Manager. but I’ll probably will need more.
This is the link to the screenshots.Hi, is there any update regarding this issue? The only way to make them able to approve users is to give them superadmin permissions. Only site admin is not enough. And I can’t do that. I only want them to access subscribers and not the whole network.
Hi @june01
Users with
edit_userscapability can approve/delete users. Have you tried checking this capability in the User Role settings?Regards,
Yeah, I’ve tried this but same issue. They only can approve users when I give them the permission to manage users in whole network:
manage_network_usersHi, is there no update on this?
Hi @june01
Could you please confirm that you’re trying to approve an account via UM Profile Form? Please see: https://drive.google.com/file/d/105AchcVXu4NRvbsOn-QDGj8HsuLAWw8B/view?usp=sharing
This is the code that
edit_usersis used for account approval:
https://github.com/ultimatemember/ultimatemember/blob/master/includes/core/um-actions-core.php#L38There are no
manage_network_usersin the validation so I’m wondering why it works for you.Regards,
without the permission “manage_network_users” I am not able to view/edit user profiles that have not been approved.
And in Member Directory page only edit and delete options are displayed. Edit does not work, just like view profile, I’ll be redirected to home.
As you can see in this screenshot.Maybe because I have multisite installation, that’s why it’s a bit different?
-
This reply was modified 4 years, 9 months ago by
june01.
Hi @june01
Could you please try running the following code snippet? You can add it to your theme/child-theme’s functions.php file or use the Code Snippet plugin to run the code.
function edit_shop_manager() { // Get custom role $user_manager = get_role('user_manager'); $user_manager->add_cap('edit_users'); } add_action( 'init', 'edit_shop_manager' );Let’s see if you can edit/approve users when running the above code.
Regards,
added this code to Code Snippets but same issue. I still can’t edit or approve new subscribers.
Hi @june01
Please try this one:
add_filter("map_meta_cap","um_100921_user_cap", 10, 4); function um_100921_user_cap( $caps, $cap, $user_id, $args ){ um_fetch_user( $user_id ); if( um_user("role") == "user_manager" ){ unset( $caps[0] ); $caps[ ] = "edit_users"; } return $caps; }Regards,
-
This reply was modified 4 years, 9 months ago by
The topic ‘Custom User Role to approve user’ is closed to new replies.