How do I remove the Other Roles field (from User Role Editor plugin) in wp-admin/user-new.php
Add this line to your functions.php file: add_filter( ‘ure_show_additional_capabilities_section’, ‘__return_false’ ); You’re welcome :))
Add this line to your functions.php file: add_filter( ‘ure_show_additional_capabilities_section’, ‘__return_false’ ); You’re welcome :))
Yes, the get_users_of_blog() function is deprecated, and the reason your code breaks after using get_users() is the ->user_id part, you should use ->ID instead. $blogusers = get_users(); if ($blogusers) { foreach ($blogusers as $bloguser) { $args = array( ‘author’ => $bloguser->ID, ‘showposts’ => 1, ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) … Read more
The item you want to remove is a “node”. When you look at the generated HTML of the WP toolbar, the ID of the list item (<li>) contains the node. So in this case, for the “Add New” toolbar item, you’ll see the following in the HTML: <li id=”wp-admin-bar-new-content” class=”menupop”> Everything after “wp-admin-bar-” in the … Read more
Looking at current_user_can()‘s documentation, I see that it uses WP_User::has_cap(). So if your code (or the WP core code) uses something like current_user_can( ‘edit_post’, $post->ID ) to determine if the current user can edit the current post, you can use the user_has_cap filter (called in WP_User::has_cap()): add_filter( ‘user_has_cap’, ‘wpse360937_allow_manager’, 10, 4 ); function wpse360937_allow_manager( $allcaps, … Read more
From quick look at code the likely permissions check for that is edit_comment capability in edit_comment() function. Your options to remove that capability roughly are: customize the role with plugin, for example Members customize role with code, probably using remove cap functionality filter thiungs around map_meta_cap or user_has_cap if you need to achieve more elaborate … Read more
I just exported the live database, replaced all occurences of the live siteurl with the local one, and imported on my dev machine. Finding/replacing with a text editor breaks serialized data; you must change values with MySQL queries in phpmyadmin: UPDATE wp_options SET option_value = replace(option_value, ‘http://www.olddomain.com/’, ‘http://www.newdomain.com/’) WHERE option_name=”home” OR option_name=”siteurl”; UPDATE wp_posts SET … Read more
function disable_admin_bar_for_subscribers(){ if ( is_user_logged_in() ): global $current_user; if( !empty( $current_user->caps[‘subscriber’] ) ): add_filter(‘show_admin_bar’, ‘__return_false’); endif; endif; } add_action(‘init’, ‘disable_admin_bar_for_subscribers’, 9);
Let’s take a look at Codex page for add_menu_page… Third param is: $capability (string) (Required) The capability required for this menu to be displayed to the user. And later on in Notes section: This function takes a ‘capability’ (see Roles and Capabilities) which will be used to determine whether or not a page is included … Read more
And the correct capability name is edit_posts. So the correct way of using current_user_can will be like following: if( empty( $post_id ) || !current_user_can( ‘edit_posts’ ) ) { return; } UPDATE: I have removed the wrong statement, but as the asker mentioned he would like to allow all roles of contributors and above to be … Read more
Without writing a custom plugin, I think your best bets would be to either: 1) use something like gravity forms and have the user start as subscriber, but then enter request to be a partner (using a GF form). GF can send notifications on forms to admin. Admin then upgrades the user’s role. 2) use … Read more