Skip to content

Instantly share code, notes, and snippets.

@jeremyfelt
Created November 15, 2013 23:50
Show Gist options
  • Select an option

  • Save jeremyfelt/7493796 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyfelt/7493796 to your computer and use it in GitHub Desktop.
<?php
// from site-new.php
$user_id = email_exists( $email );
if ( ! $user_id ) { // Create a new user with a random password
$password = wp_generate_password( 12, false );
$user_id = wpmu_create_user( $domain, $password, $email );
if ( false == $user_id )
wp_die( __( 'There was an error creating the user.' ) );
else
wp_new_user_notification( $user_id, $password );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment