Filter username field on registration for profanity and unwanted words

There are two very different hooks you can use, depending on the installation: wpmu_validate_user_signup for multi-site and registration_errors for single-site. The following untested code shows how to use them. You can tweak the array in user_name_is_forbidden() to your needs. Use regular expressions for the matches. // multi-site add_filter( ‘wpmu_validate_user_signup’, function( $result ) { // there … Read more

Can I hook into user registration *before* a user is created?

You’re looking in the wrong place. When a user first attempts to register, their username and email is processed and sanitized inside the register_new_user() function in wp-login.php. This is where you want to do your filtering. Before the user is created, WordPress will pass the sanitized user login, email address, and an array or errors … Read more

How do I create a password reset link?

After much research, I finally turned to examining the WordPress core file wp_login.php hoping that WP would show how they do it in a non-obtuse manner. From the information around line 331 (WP 4.6.1), I put together the following code. <?php global $gw_activate_template; extract( $gw_activate_template->result ); $url = is_multisite() ? get_blogaddress_by_id( (int) $blog_id ) : … Read more

User Without Email?

It’s possible, just no so easily via the Users page without some hackery. The WordPress API will let you insert users without email addresses, so a little custom plugin to accept a login name and password, and a call to wp_insert_user or wp_update_user should work for you. Unfortunately I don’t have time to code it … Read more

Google Apps login in wordpress

Use the plugin WordPress Social Login: http://wordpress.org/extend/plugins/wordpress-social-login/ Does exactly what you want except the user doesn’t actually have to type in their username and password if they are already logged in to Google Apps – they just click the Google icon and it will log them in to WordPress using Google Apps. And yes, you … Read more

Send user activation email when programmatically creating user

To accomplish user activation process you need to do following steps: after create new user add a custom user field which indicates that this user has to activate his account send an email with activation code, provide a link in this email to a page where user will be activated implement activation page when user … Read more

What’s the difference between wp_insert_user() and wp_create_user()

None. The whole source of wp_create_user() is: function wp_create_user($username, $password, $email=””) { $user_login = esc_sql( $username ); $user_email = esc_sql( $email ); $user_pass = $password; $userdata = compact(‘user_login’, ‘user_email’, ‘user_pass’); return wp_insert_user($userdata); } It just calls insert version almost immediately, basically a shorthand wrapper. As for why it exists – core works in mysterious ways … Read more

How do I customise the new user welcome email

SB Welcome Email Editor works by replacing wp_new_user_notification() with an own version. The original version can be found in wp-includes/pluggable.php, the plugin uses an elaborate replacement with all kinds of options. You can do this to: create a new plugin (just a PHP file in wp-content/plugins/), and define wp_new_user_notification($user_id, $plaintext_pass=””) there. This will then be … Read more