How to allow an user role to create a new user under a role which lower than his level only?

Firstly, you need to add the following capabilities to the Doctor and Receptionist role: list_users edit_users create_users delete_users Now we can get to work with controlling which users they can create/edite/delete. Let’s start with a “helper” function that will return which roles a user is allowed to edit: /** * Helper function get getting roles … Read more

How can I allow the Editor Role to change Theme Settings?

you can add capabilities to the editor role using the role object and add_cap from you functions.php <?php // get the the role object $editor = get_role(‘editor’); // add $cap capability to this role object $editor->add_cap(‘edit_theme_options’); ?> you can also remove capabilities: $editor->remove_cap(‘delete_posts’); just take a look at the list of capabilities and what each … Read more

Possible to hide Custom Post Type UI/Menu from specific User Roles?

To hide a post type menu item from non-admin users: function wpse28782_remove_menu_items() { if( !current_user_can( ‘administrator’ ) ): remove_menu_page( ‘edit.php?post_type=your_post_type’ ); endif; } add_action( ‘admin_menu’, ‘wpse28782_remove_menu_items’ ); your_post_type should be the name of your actual post type. EDIT- other menu pages you can remove: remove_menu_page(‘edit.php’); // Posts remove_menu_page(‘upload.php’); // Media remove_menu_page(‘link-manager.php’); // Links remove_menu_page(‘edit-comments.php’); // … Read more

How to create a clone role in wordpress

Try this… This should work. <?php add_action(‘init’, ‘cloneRole’); function cloneRole() { global $wp_roles; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); $adm = $wp_roles->get_role(‘administrator’); //Adding a ‘new_role’ with all admin caps $wp_roles->add_role(‘new_role’, ‘My Custom Role’, $adm->capabilities); } ?> Check it.

Is there way to rename user role name without plugin?

function change_role_name() { global $wp_roles; if ( ! isset( $wp_roles ) ) $wp_roles = new WP_Roles(); //You can list all currently available roles like this… //$roles = $wp_roles->get_names(); //print_r($roles); //You can replace “administrator” with any other role “editor”, “author”, “contributor” or “subscriber”… $wp_roles->roles[‘administrator’][‘name’] = ‘Owner’; $wp_roles->role_names[‘administrator’] = ‘Owner’; } add_action(‘init’, ‘change_role_name’); http://www.garyc40.com/2010/04/ultimate-guide-to-roles-and-capabilities/

Allow member to have access to custom post type only. Permission to only edit their own posts

Use Justin Tadlock’s plugin “Members“. It gives you the ability to create new roles and edit existing roles, as well as add custom capabilities. All that work that you’d have to do can be taken down to a few clicks. I know you said in your comment on ZaMoose’s answer that you are ‘looking to … Read more

Editor can create any new user except administrator

It’s actually pretty easy. You need to filter into map_meta_caps and stop editors from creating/editing admins, and remove the administrator role from the ‘editable roles’ array. This class, as a plugin or in your theme’s functions.php file would do it: class JPB_User_Caps { // Add our filters function __construct(){ add_filter( ‘editable_roles’, array($this, ‘editable_roles’)); add_filter( ‘map_meta_cap’, … Read more

How to change a user’s role?

See the WP_User class, you can use this to add and remove roles for a user. EDIT: I really should have provided more information with this answer initially, so i’m adding more information below. More specifically, a user’s role can be set by creating an instance of the WP_user class, and calling the add_role() or … Read more

Getting a List of Currently Available Roles on a WordPress Site?

Roles are stored in the global variable $wp_roles. The ideal function is get_editable_roles() from /wp-admin/includes/user.php function get_editable_roles() { global $wp_roles; $all_roles = $wp_roles->roles; $editable_roles = apply_filters(‘editable_roles’, $all_roles); return $editable_roles; } The “editable” part is because it offers other plugins a chance to filter the list in case someone other than admin has ‘edit_users’ privilege (and … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)