Letting users create a post that is a custom post type from a page
You can create a new role and name it anything you like. Then you can add any type of capability you like https://wordpress.stackexchange.com/a/129807/9884
You can create a new role and name it anything you like. Then you can add any type of capability you like https://wordpress.stackexchange.com/a/129807/9884
If you want to specifically deny a capability from a user (not a role), you need to use the add_cap() method and specify that the $grant parameter is false. $user = new WP_User( ‘Y’ ); $user->add_cap( ‘edit_plugins’, false );
Changed the code in functions.php to this: function get_user_role() { global $current_user; $user_roles = $current_user->roles; $user_role = array_shift($user_roles); return $user_role; } And in the sidebar.php: <?php if (is_page(array(‘page1’)) && get_user_role(‘Administrator’)) : echo ‘<div class=”widget-title”>Title 1</div>’ . wp_nav_menu(array(‘theme_location’=>’menu1’ )); elseif (is_page(array(‘page2’))) : echo ‘<div class=”widget-title”>Page 2</div>’ . wp_nav_menu(array(‘theme_location’=>’menu2’ )); elseif (is_page(array(‘page 3’))) : echo ‘<div class=”widget-title”>Page … Read more
I would approach the situation like: Create an user with subscriber role. Add a meta field to the user profile. This will be the password like field you will verify the user against. Use AJAX to verify the password(meta value) entered by the visitor and display product specification accordingly. You do not have to worry … Read more
So I Migrated the contents of meta_Key ‘wp_user_roles’ from the wp_options table from one server to another after a backup and it worked , the Roles migration was successful.
This line in your wpo_add_caps() function is incorrect: $admin->add_cap( ‘administrator’, $admin_cap ); It should simply read: $admin->add_cap( $admin_cap ); Source: WP_Role::add_cap().
Read the WordPress Codex on the subject of Roles http://codex.wordpress.org/Roles_and_Capabilities To confirm that the system works the way you want, as an admin create a test member with the author role and sample content as you would for a ‘real’ member. Then sign out and sign in using your test member’s credentials and see what … Read more
That’s the correct way to get what you need. Though I’m not sure why WordPress returns an array of roles since ( to my knowledge ) you can only have 1 role at a time. Roles being an array you can modify by just retrieving the role index 0: $blogusers = get_users(); // Array of … Read more
In multisite installation there already is a default admin and super-admin role, and if standard capabilities are different than what you want you can modify them: A default set of capabilities is pre-assigned to each role, but other capabilites can be assigned or removed using the add_cap() and remove_cap() functions. New roles can be introduced … Read more
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 non-administrators */ ) … Read more