How many users can WordPress handle?
According WP database structure, ID in wp_users is Bigint(20) UNSIGNED, so you could “theoretically” add 18446744073709551615 users. http://dev.mysql.com/doc/refman/4.1/en/integer-types.html
According WP database structure, ID in wp_users is Bigint(20) UNSIGNED, so you could “theoretically” add 18446744073709551615 users. http://dev.mysql.com/doc/refman/4.1/en/integer-types.html
The size of the table isn’t really the issue, the queries you’re running on that table might be. For example, if you’re selecting users based on data stored in the user-meta table, then that query will be highly unoptimized, because meta_value is not an indexed field. In which case you may need to add extra … Read more
<?php $current_user = wp_get_current_user(); if ( ! user_can( $current_user, “subscriber” ) ) // Check user object has not got subscriber role echo ‘User is a not Subscriber’; else echo ‘User is a Subscriber’; ?>
Put this in your functions.php file: function wpse_131562_redirect() { if ( ! is_user_logged_in() && (is_woocommerce() || is_cart() || is_checkout()) ) { // feel free to customize the following line to suit your needs wp_redirect(home_url()); exit; } } add_action(‘template_redirect’, ‘wpse_131562_redirect’); What does it do? We check if a not-logged-in user wants to see a WooCommerce page, … Read more
As far as I’m aware, all you can do is filter the display name via pre_user_display_name and check if it already exists. Unfortunately WP_User_Query doesn’t support querying by display_name, so we also have to add to the WHERE clause via pre_user_query. Additionally, there is no elegant way I can think of to handle the case … Read more
You can use spaces in usernames, no problem. Several users on wordpress.org have spaces in their usernames. Strict mode only allows these characters: a-z0-9<space>_.\-@ However WP doesn’t default to strict mode. Now, multisite has different restrictions, and it may strip spaces there. This is because usernames are used to create independent blogs and such on … Read more
In layman terms there is no major difference! update_user_option() uses update_user_meta() internally. The only difference is update_user_option() prefix the option name with database table prefix + blog ID if you are in multisite and just table prefix if you are in single site installation. Take a look at the code of update_user_option() /** * Update … Read more
Use this function: function user_id_exists($user){ global $wpdb; $count = $wpdb->get_var($wpdb->prepare(“SELECT COUNT(*) FROM $wpdb->users WHERE ID = %d”, $user)); if($count == 1){ return true; }else{ return false; } } Usage: if(user_id_exists(1)){ //it does exists } else { //it doesn’t }
Hi @user2041: Clearly as you know you need to modify the search that’s performed which you can do by modifying the values in the instance of the WP_User_Search class used for the search (you can find the source code at /wp-admin/includes/user.php if you’d like to study it.) The WP_User_Search Object Here’s what a print_r() of … Read more
user_new_form is the hook that can do the magic here. function custom_user_profile_fields($user){ ?> <h3>Extra profile information</h3> <table class=”form-table”> <tr> <th><label for=”company”>Company Name</label></th> <td> <input type=”text” class=”regular-text” name=”company” value=”<?php echo esc_attr( get_the_author_meta( ‘company’, $user->ID ) ); ?>” id=”company” /><br /> <span class=”description”>Where are you?</span> </td> </tr> </table> <?php } add_action( ‘show_user_profile’, ‘custom_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘custom_user_profile_fields’ … Read more