add_role user capability not working
add_role user capability not working
add_role user capability not working
I resolved this by adding checks via the “content_edit_pre” WP hook. I quickly check on the status of the post and if it is already pending I return the user back to the post listing page and then show an error. // Redirect edit post page back to the list page when pending add_action( ‘content_edit_pre’, … Read more
Please edit your function and add code used below for adding user role in functions.php This is basic idea how roles can be added and removed and how you can check your filed values. Please use according to your requirements. add_action( ‘profile_update’, ‘my_profile_update’, 10, 2 ); function my_profile_update( $user_id, $old_user_data ) { // here you … Read more
Rename Existing Role Name : function wps_change_role_name() { global $wp_roles; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); if($wp_roles->roles[‘contributor’][‘name’] = ‘Owner’) { $wp_roles->roles[‘contributor’][‘name’] = ‘Contributor’ $wp_roles->role_names[‘contributor’] = ‘Contributor’; } } add_action(‘init’, ‘wps_change_role_name’); From database you can see role : I see a table called “wp_options” with a row named “wp_user_roles”. It contains: … Read more
Add a button or radio box that update the user role
Custom capabilities to add, edit, remove users of a particular role only?
This I have achieved without using any plugin. In admin I created custom field to fetch all the authors in the multiselect box. Here the editor can select as many author he wants. Then I added function in function.php file to fetch all the posts created by the current editor user and also by the … Read more
How to have kind of a technical writer role in wp website
Allowing user to edit posts based on the post status
This appeared to be the result of (what I assume) was the User Role Editor plugin being updated, and then directly affecting the wp_user_role field on the options table of the database, which somehow led to DISALLOW_FILE_EDIT being ignored. I had to take several steps to fix this, as there were custom user roles I … Read more