Tag Info

Hot answers tagged

3

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 ...


2

OK, so your first problem is that $current_user->roles is an array and not a string, so your condition won't be true ;) My another concern would be the hook you're using. Some plugins may use it for other purposes, and killing the script can be harmful. And... there is much better hook for this ;) First solution: using login_redirect hook function ...


2

Hint The changes on roles and no layout-topics should not a part of a Theme, is much more a topic for a plugin. maybe you think about this topic on point like maintenance, switch of theme and hooks for activation - easier on plugins. For your problem You must add the roles new capabilities for your custom post type and remove the capabilities for type ...


1

This is treading very close to being off-topic as it asks specifically about a particular plugin, but the answer is quite generic: You can remove the capabilities you don't need. function remove_cap_wpse_186316(){ remove_cap( 'yourwoorole', 'yourwoocap' ); remove_cap( 'yourwoorole', 'yourwoocap1' ); } add_action( 'admin_init', ...


1

You should declare your desired capabilities when you are registering the post type. Justin's article here is a good one for custom post types: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress When you are registering your custom post type, you can set this to be standard capabilities for posts, eg: 'capability_type' => ...


1

Don't remove the capability - this will make all editors unable to edit all posts. Instead, use a filter to conditionally determine if the post can be edited: function wpse_187738_map_meta_cap( $caps, $cap, $user_ID, $args ) { if ( $cap === 'edit_post' && $args && ! current_user_can( 'manage_options' ) /** Only proceed for ...


1

This is right. You can use Wordpress in exactly the same way as you were using your OLD CMS. Wordpress is being used by Top newspapers / magazines and websites and they've editors / authors and bloggers and ofcourse they have groups & roles. CNN, Mashabale, TechCrunch, etc are all based on Wordpress. There are Free and Premium both type of plugins to ...


1

Add the capabilities to the role. Replace 'cpt' with the name of your custom post type: $role = get_role( 'contributor' ); $role->add_cap( 'delete_published_cpt' ); $role->add_cap( 'delete_others_cpt' ); $role->add_cap( 'delete_cpt' ); $role->add_cap( 'edit_others_cpt' ); $role->add_cap( 'edit_published_cpt' ); $role->add_cap( 'edit_cpt' ...


1

I've found it. /*** Adding extra field to get the the user who creates the another user during ADD NEW USER ***/ function custom_user_profile_fields($user){ if(is_object($user)) $created_by = esc_attr( get_the_author_meta( 'created_by', $user->ID ) ); else $created_by = null; ?> <h3>Extra profile ...



Only top voted, non community-wiki answers of a minimum length are eligible