Remove Ability for Other Users to View Administrator in User List?

Hi @Carlos: Try adding the following to your theme’s functions.php file, or in a .php file within a plugin that you might be writing (which works for WordPress 3.1.x): add_action(‘pre_user_query’,’yoursite_pre_user_query’); function yoursite_pre_user_query($user_search) { $user = wp_get_current_user(); if ($user->ID!=1) { // Is not administrator, remove administrator global $wpdb; $user_search->query_where = str_replace(‘WHERE 1=1’, “WHERE 1=1 AND {$wpdb->users}.ID<>1”,$user_search->query_where); … Read more

Give Editor Access To Sidebar

The edit_theme_options capability should allow the user to edit the sidebar as described on this page : http://codex.wordpress.org/Appearance_Widgets_SubPanel Code to add to functions.php $role = get_role(‘editor’); $role->add_cap(‘edit_theme_options’); Edit: This should work to prevent editor accessing themes or menus function custom_admin_menu() { $user = new WP_User(get_current_user_id()); if (!empty( $user->roles) && is_array($user->roles)) { foreach ($user->roles as $role) … Read more

How to get role of user

Use the user ID and WP_User: $user = new WP_User( $user_id ); print wp_sprintf_l( ‘%l’, $user->roles ); Update /** * Get user roles by user ID. * * @param int $id * @return array */ function wpse_58916_user_roles_by_id( $id ) { $user = new WP_User( $id ); if ( empty ( $user->roles ) or ! is_array( … Read more

Remove update nags for non-admins [duplicate]

In wp-admin/includes/update.php file if ( current_user_can(‘update_core’) ) $msg = sprintf( __(‘An automated WordPress update has failed to complete – <a href=”https://wordpress.stackexchange.com/questions/231010/%s”>please attempt the update again now</a>.’), ‘update-core.php’ ); else $msg = __(‘An automated WordPress update has failed to complete! Please notify the site administrator.’); We can see that messages are different based on the current … Read more

Site admin in a network install can’t edit users?

As explained in the description of the Network Admin Users screen, in a network install (multisite mode) users are added on a global basis to the entire network, then assigned to specific sites Normal administrators are not permitted to modify these global profiles, since their privileges extend only to their given site. This task is … Read more

How can I get a list of users by their role?

There may be some different way to do that, but most proper way to do that is following. <?php $args = array( ‘role’ => ‘Your desired role goes here.’, ‘orderby’ => ‘user_nicename’, ‘order’ => ‘ASC’ ); $users = get_users( $args ); echo ‘<ul>’; foreach ( $users as $user ) { echo ‘<li>’ . esc_html( $user->display_name … Read more

Why are my roles not visible in a Multi-site/Network?

Determine your Multisite Blog ID. I will use 99 as an example Go into the database Go to this table: wp_##_options (wp_99_options) — you will have a table for each blog Find the record where option_name = wp_user_roles Change the text wp_user_roles to wp_##_user_roles (“wp_99_user_roles”) The table you are editing will have option_id, blog_id, option_name, … Read more

How to add a Capability to a User Role?

You can use WP_Role class, // get the the role object $role_object = get_role( $role_name ); // add $cap capability to this role object $role_object->add_cap( $capability_name ); // remove $cap capability from this role object $role_object->remove_cap( $capability_name ); So to address your original question about how to enable Admins to enter SCRIPT and IFRAME tags … Read more

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