Give editor ability to edit custom settings without access to Main Settings
Use the Settings API or hook a function to admin_init that checks permissions and nonces, saves the updated values and redirects to the custom settings page.
Use the Settings API or hook a function to admin_init that checks permissions and nonces, saves the updated values and redirects to the custom settings page.
This is one way to do it add_action(‘user_register’, ‘set_custom_default_role’) function set_custom_default_role($user_id) { // Maybe get available referral codes from database & compare them against the one available if(true) { $user = new WP_User( $user_id ); $user->set_role(‘custom-role-slug’); } }
I am not claiming this is a canonical list but the user related capabilities I see are: add_users create_users delete_users edit_users list_users promote_users remove_users I got this working with only list_users and edit_users. I did test all combinations of those, just a few obvious ones. Of course, you may want more capabilities than that.
Sounds like your authors need to be ‘Editors’.
Here is what you need to do: function set_user_rcp_default_subscriber($user_id) { $user = new WP_User( $user_id ); foreach( $user->roles as $role ) { if ( $role === ‘subscriber’ ) { update_user_meta( $user_id, ‘wp_user_level’, ‘0’ ); update_user_meta( $user_id, ‘rcp_subscription_level’, ‘1’ ); update_user_meta( $user_id, ‘rcp_status’, ‘active’ ); update_user_meta( $user_id, ‘rcp_expiration’, ‘2014-06-30’ ); } } } add_action(“user_register”, “set_user_rcp_default_subscriber”, 10, … Read more
Assign specific editor with custom user meta “A” to all authors with custom user meta “A” and exclude all other author access
You cannot assign capabilities to unknown users. If you want to make a post visible for everyone, create a separate URL for these posts and add a control element to the post editor to enable the preview on selected posts only. When such an URL is called, check if a preview is allowed for the … Read more
Check out the User Role Editor plugin in the WP repository: http://wordpress.org/plugins/user-role-editor/ You can edit the permissions of a role with this plugin.
Adapt the easier way. Install a plugin (Ex. Members) that can manage roles. Create one role with restricted access in your case a role with all the capabilities but not ‘create_users’, ‘add_user’, ‘list_users’,. Save this new role and assign it to the user you want to grant these restricted privileges.
You can add the capability by using add_cap. But as far as I know there is no way to do this only for their posts, so it would be for all posts.