Admin permission for creating blogs in multisite
Welcome to WordPress Stack Exchange! 🙂 There is a setting on wp-admin/network/settings.php where you can enable just registration but not new sites:
Welcome to WordPress Stack Exchange! 🙂 There is a setting on wp-admin/network/settings.php where you can enable just registration but not new sites:
Looking around Google for a few minutes yielded several promising results. Here’s a more detailed one adapted from a snippet on The Code Collective: function get_user_roles( $user_id ) { $user_roles = []; $user = get_userdata( $user_id ); $capabilities = $user->{$wpdb->prefix . ‘capabilities’}; if ( !isset( $wp_roles ) ) { $wp_roles = new WP_Roles(); foreach ( … Read more
As a plugin all that I can give to you is this. <?php /* Plugin Name: Users Table Plugin URI: http://www.exe.ie Description: A list of all available users with their ID, Name, Registration Date, Nickname, User Level and User Role Version: 1.0 Author: Daniel Conde Author URI: http://www.exe.ie License: GPL */ add_action(‘admin_menu’, ‘my_user_table_menu’); function my_user_table_menu() … Read more
Try buildin function get_users. The code should be like that: $args = array( ‘role’ => ‘editor’ ); $editors = get_users($args); foreach ($editors as $user) { echo ‘<li>’ . $user->ID . ‘</li>’; }
You can use the user_registration action to set a custom role directly after wp_insert_user() has been called. add_action(‘user_register’, ‘foo_set_new_user_role’, 9999, 1); function foo_set_new_user_role($user_id){ $user = new WP_User( $user_id ); $user->set_role(‘your_new_role’); } You can also use the action profile_update for just that, profile updates. It takes two parameters $user_id and $old_user_data. Hope this helps you out.
Check out the Posts 2 Posts plugin…it may be able to handle easily associating certain posts with certain users regardless of user-role capablities. It is especially useful if you have some sort of multiple author setup. wordpress.org/extend/plugins/posts-to-posts/
Your question is actually pretty good, as you’ve found an edge case. The level (0-10) are still built into the roles system. So your custom role names collide with the built in capabilities. As role names get added as capability too, you should switch them to something more unique. Hint: Roles are a flat system. … Read more
Filter Menu Items by Custom User Role in a page
bbPress: How to set conditional for specific user -or- user role, to be displayed in user profile
Replace all occurrences of $current_user->user_login == ‘username’ with in_array(‘editor’, $current_user->roles). And you can remove the call to get_currentuserinfo(); as for the user information is available from the global variable $current_user. Here’s a code swap: add_action(‘_admin_menu’, ‘remove_editor_submenu’, 1); function remove_editor_submenu() { global $current_user; if(in_array(‘editor’, $current_user->roles)) { remove_action(‘admin_menu’, ‘_add_themes_utility_last’, 101); } } add_action(‘admin_init’, ‘remove_theme_submenus’); function remove_theme_submenus() { … Read more