-
Hi there,
I need to give the editor role permissions to edit all user profiles from the front end also to be able to click the verified button in wp/admin/users columns.
I have tried giving permissions via role editor, adding: “manage_userpro” and various variations, to no avail.
How to give access to userpro for website editors?
Okay I have managed to give editor role the capability to click the verify button under wp-adm/users/verify column, by changing manage_options to edit_users in the admin-functions.php file
PHP12345678Verify a user instantly**/add_action('wp_ajax_nopriv_userpro_verify_user', 'userpro_verify_user');add_action('wp_ajax_userpro_verify_user', 'userpro_verify_user');function userpro_verify_user(){if (!current_user_can('manage_options'))die(); // admin privI also managed to give editor role the capability to see the edit button on front end profiles and to edit the user profiles, by editing the user-functions.php and replacing manage_options with edit_users.
However, when editor edits the profiles, his edits do not save, so guess I need to edit another file to get things to work properly?
Okay I have finally managed to sort out the capability problem.
For anyone else who wants to give capibility to other user roles to administer userpro profiles, without giving the user role access to userpro settings itself, this is what I did:
Edit the following 3 files:admin_functions.php
user-functions.php
ajax.php1. In ajax.php replace “manage_options” with whatever capability you have given the user. For instance I’m giving the editor role control over all user profiles, including backend verification and editing the profiles from front end.
So in ajax.php I changed the following code, replacing manage_options with edit_users:PHP123456789/* editing */case 'edit':if ($user_id != get_current_user_id() && !current_user_can('manage_options') )die();userpro_update_user_profile( $user_id, $form, $action='ajax_save' );if (userpro_get_option('notify_admin_profile_save') && !current_user_can('manage_options') ){userpro_mail( $user_id , 'profileupdate', null, $form );2.In user-functions.php, I replaced all instances of manage_options with edit_users.
3.In admin-functions.php, I changed the instance of manage_options with edit_users in the following piece of code:
PHP123456**/add_action('wp_ajax_nopriv_userpro_verify_user','userpro_verify_user');add_action('wp_ajax_userpro_verify_user','userpro_verify_user');function userpro_verify_user(){if (!current_user_can('manage_options'))die(); // admin privThere is probably an easier way to do this, but since I was pressed for time and only had a few hours today to get a solution to my problem, I took to editing the files till I found the solution….lol
This is the easiest way! Change the capability manage_options to edit_users , basically the same thing. 🙂 But some roles can edit users but can’t manage blogs/delete posts,etc… normal
Hi Ahmed,
Ah and here I thought that my way was the difficult way of doing it….lol
In my case the editor role can manage all menus, widgets, pages, posts & user profiles, but can’t access USERPRO settings or any other plugin settings or themes, hence I selectively changed capabilities only on some code instances in the files mentioned above.
You must be logged in to reply to this topic.