Fatal error: Call to undefined function register_new_user()

I greped a 3.6 install and got this: ./wp-login.php:321:function register_new_user( $user_login, $user_email ) { ./wp-login.php:550: $errors = register_new_user($user_login, $user_email); Notice the function definition is in wp-login.php. If you look at the current wp-login.php, it isn’t there anymore and there is a note at the top of the page, just above the code: Last change on … Read more

wp_create_user not properly entering password

PHP support variable-lengths argument lists. Simply put you can pass as many additional arguments as you want to any function and PHP won’t even blink. If you look at the source of $wpdb->prepare() method it simply fetches all arguments with func_get_args() into variable and works with that. It doesn’t care about function signature (older or … Read more

Data sanitization for user registration and user login

You can check my tutorial for front-end user registration and login in WordPress: http://www.cozmoslabs.com/1012-wordpress-user-registration-template-and-custom-user-profile-fields/ As to the wp_signon, wp_insert_user, wp_create_user and wp_update_user they take care of all sanitation and validation of your content. Also you don’t need to use those filters in wp_create_user to create your users.

Do I need to flush rewrite rules when creating new user if using custom author rewrite rules?

Yes, you should flush rewrite rules in this case, because you add rules for every author based on his nicename. To be more precise, you should flush them after any author changes his nicename also. And you do this using author_rewrite_rules hook, which is fired in wp_rewrite_rules() only when there are no rules in database. … Read more

How to display user’s nickname by default instead of username

Instead of wp_create_user, use wp_insert_user. So you will be able to set extra variables like nickname, display_name separately than the default value. For your case, you can code like this: $args = array ( ‘user_login’ => $user_name, ‘user_pass’ => $random_password, //send as plain text password string ‘user_email’ => $user_email, ‘nickname’ => $user_nickName, ‘display_name’ => $user_nickName … Read more

Generating User(s) with Settings API

You are using add_settings_field wrong: the function sl_wp_create_user is being passed as $args (and you probably don’t need any args), and it should be the sanitize callback for register_settings. Make the input like: function sl_render_users_input() { echo ‘<input id=”num_users[value]” name=”num_users[value]” type=”input” value=”” />’; } And the sanitize function: function sl_wp_create_user( $input ) { if( isset( … Read more