How to use same email for multiple users

You can use wpmu_validate_user_signup filter to remove the error and then define WP_IMPORTING just to skip the email_exist() check in wp_insert_user() function: add_filter(‘wpmu_validate_user_signup’, ‘skip_email_exist’); function skip_email_exist($result){ if(isset($result[‘errors’]->errors[‘user_email’]) && ($key = array_search(__(‘Sorry, that email address is already used!’), $result[‘errors’]->errors[‘user_email’])) !== false) { unset($result[‘errors’]->errors[‘user_email’][$key]); if (empty($result[‘errors’]->errors[‘user_email’])) unset($result[‘errors’]->errors[‘user_email’]); } define( ‘WP_IMPORTING’, ‘SKIP_EMAIL_EXIST’ ); return $result; } UPDATE: for … Read more

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

How to search for (partial match) display names of WordPress users?

Searching the main table Simply use WP_User_Query with a search argument. So if you want to search for example for a user with a keyword in his user_email or similar columns from the {$wpdb->prefix}users table, then you can do the following: $users = new WP_User_Query( array( ‘search’ => ‘*’.esc_attr( $your_search_string ).’*’, ‘search_columns’ => array( ‘user_login’, … 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 allow an user role to create a new user under a role which lower than his level only?

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 … Read more