Users: In wpmu_signup_blog() and wpmu_signup_user(), pass unserialized signup meta data to after_signup_site and after_signup_user filters introduced in [34112], to match the documented value.

Props MaximeCulea.
Fixes #38781.

git-svn-id: https://develop.svn.wordpress.org/trunk@39886 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2017-01-12 04:56:28 +00:00
parent 89f6427e01
commit 41134d34da

View File

@ -664,13 +664,12 @@ function wpmu_validate_blog_signup( $blogname, $blog_title, $user = '' ) {
* @param string $title The requested site title. * @param string $title The requested site title.
* @param string $user The user's requested login name. * @param string $user The user's requested login name.
* @param string $user_email The user's email address. * @param string $user_email The user's email address.
* @param array $meta By default, contains the requested privacy setting and lang_id. * @param array $meta Optional. Signup meta data. By default, contains the requested privacy setting and lang_id.
*/ */
function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) { function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = array() ) {
global $wpdb; global $wpdb;
$key = substr( md5( time() . wp_rand() . $domain ), 0, 16 ); $key = substr( md5( time() . wp_rand() . $domain ), 0, 16 );
$meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array( $wpdb->insert( $wpdb->signups, array(
'domain' => $domain, 'domain' => $domain,
@ -680,7 +679,7 @@ function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = a
'user_email' => $user_email, 'user_email' => $user_email,
'registered' => current_time('mysql', true), 'registered' => current_time('mysql', true),
'activation_key' => $key, 'activation_key' => $key,
'meta' => $meta 'meta' => serialize( $meta )
) ); ) );
/** /**
@ -693,8 +692,8 @@ function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = a
* @param string $title The requested site title. * @param string $title The requested site title.
* @param string $user The user's requested login name. * @param string $user The user's requested login name.
* @param string $user_email The user's email address. * @param string $user_email The user's email address.
* @param string $key The user's activation key * @param string $key The user's activation key.
* @param array $meta By default, contains the requested privacy setting and lang_id. * @param array $meta Signup meta data. By default, contains the requested privacy setting and lang_id.
*/ */
do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta ); do_action( 'after_signup_site', $domain, $path, $title, $user, $user_email, $key, $meta );
} }
@ -711,7 +710,7 @@ function wpmu_signup_blog( $domain, $path, $title, $user, $user_email, $meta = a
* *
* @param string $user The user's requested login name. * @param string $user The user's requested login name.
* @param string $user_email The user's email address. * @param string $user_email The user's email address.
* @param array $meta By default, this is an empty array. * @param array $meta Optional. Signup meta data. Default empty array.
*/ */
function wpmu_signup_user( $user, $user_email, $meta = array() ) { function wpmu_signup_user( $user, $user_email, $meta = array() ) {
global $wpdb; global $wpdb;
@ -720,7 +719,6 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
$user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) ); $user = preg_replace( '/\s+/', '', sanitize_user( $user, true ) );
$user_email = sanitize_email( $user_email ); $user_email = sanitize_email( $user_email );
$key = substr( md5( time() . wp_rand() . $user_email ), 0, 16 ); $key = substr( md5( time() . wp_rand() . $user_email ), 0, 16 );
$meta = serialize($meta);
$wpdb->insert( $wpdb->signups, array( $wpdb->insert( $wpdb->signups, array(
'domain' => '', 'domain' => '',
@ -730,7 +728,7 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
'user_email' => $user_email, 'user_email' => $user_email,
'registered' => current_time('mysql', true), 'registered' => current_time('mysql', true),
'activation_key' => $key, 'activation_key' => $key,
'meta' => $meta 'meta' => serialize( $meta )
) ); ) );
/** /**
@ -740,8 +738,8 @@ function wpmu_signup_user( $user, $user_email, $meta = array() ) {
* *
* @param string $user The user's requested login name. * @param string $user The user's requested login name.
* @param string $user_email The user's email address. * @param string $user_email The user's email address.
* @param string $key The user's activation key * @param string $key The user's activation key.
* @param array $meta Additional signup meta. By default, this is an empty array. * @param array $meta Signup meta data. Default empty array.
*/ */
do_action( 'after_signup_user', $user, $user_email, $key, $meta ); do_action( 'after_signup_user', $user, $user_email, $key, $meta );
} }