Send multisite site/user signup emails via hooked functions.

Site and user signup notifications are moved to the new actions
`'after_signup_site'` and `'after_signup_user'`. Site and user activation
notifications are moved to the existing actions `'wpmu_activate_blog'` and
`'wpmu_activate_user'`.

Props dshanske, thomaswm, jeremyfelt.
See #33587..
Built from https://develop.svn.wordpress.org/trunk@34112


git-svn-id: http://core.svn.wordpress.org/trunk@34080 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Boone Gorges 2015-09-14 03:28:24 +00:00
parent ecc4106ed1
commit 49803a45f3
3 changed files with 30 additions and 5 deletions

View File

@ -25,12 +25,16 @@ add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
add_action( 'init', 'maybe_add_existing_user_to_blog' ); add_action( 'init', 'maybe_add_existing_user_to_blog' );
add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' ); add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 ); add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
add_filter( 'sanitize_user', 'strtolower' ); add_filter( 'sanitize_user', 'strtolower' );
// Blogs // Blogs
add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' ); add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 ); add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 ); add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
add_action( 'after_signup_site', 'wpmu_signup_blog_notification', 10, 7 );
// Register Nonce // Register Nonce
add_action( 'signup_hidden_fields', 'signup_nonce_fields' ); add_action( 'signup_hidden_fields', 'signup_nonce_fields' );

View File

@ -745,7 +745,20 @@ function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = a
'meta' => $meta 'meta' => $meta
) ); ) );
wpmu_signup_blog_notification($domain, $path, $title, $user, $user_email, $key, $meta); /**
* Fires after site signup information has been written to the database.
*
* @since 4.4.0
*
* @param string $domain The requested domain.
* @param string $path The requested path.
* @param string $title The requested site title.
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key
* @param array $meta By default, contains the requested privacy setting and lang_id.
*/
do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta );
} }
/** /**
@ -782,7 +795,17 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
'meta' => $meta 'meta' => $meta
) ); ) );
wpmu_signup_user_notification($user, $user_email, $key, $meta); /**
* Fires after a user's signup information has been written to the database.
*
* @since 4.4.0
*
* @param string $user The user's requested login name.
* @param string $user_email The user's email address.
* @param string $key The user's activation key
* @param array $meta Additional signup meta. By default, this is an empty array.
*/
do_action( 'after_signup_user', $user, $user_email, $key, $meta );
} }
/** /**
@ -1027,7 +1050,6 @@ function wpmu_activate_signup($key) {
if ( isset( $user_already_exists ) ) if ( isset( $user_already_exists ) )
return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup); return new WP_Error( 'user_already_exists', __( 'That username is already activated.' ), $signup);
wpmu_welcome_user_notification( $user_id, $password, $meta );
/** /**
* Fires immediately after a new user is activated. * Fires immediately after a new user is activated.
* *
@ -1055,7 +1077,6 @@ function wpmu_activate_signup($key) {
} }
$wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) ); $wpdb->update( $wpdb->signups, array('active' => 1, 'activated' => $now), array('activation_key' => $key) );
wpmu_welcome_notification($blog_id, $user_id, $password, $signup->title, $meta);
/** /**
* Fires immediately after a site is activated. * Fires immediately after a site is activated.
* *

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.4-alpha-34111'; $wp_version = '4.4-alpha-34112';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.