From 6c405b8f36c6b08504118eb98ceb380846871f4f Mon Sep 17 00:00:00 2001 From: Jeremy Felt Date: Tue, 24 May 2016 04:16:27 +0000 Subject: [PATCH] Multisite: Clean up `WP_Error` documentation and handling in `wp-signup.php` Fixes #36927. Built from https://develop.svn.wordpress.org/trunk@37547 git-svn-id: http://core.svn.wordpress.org/trunk@37515 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-signup.php | 68 +++++++++++++++++++++++------------------ 2 files changed, 39 insertions(+), 31 deletions(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index ca6ca2c2e3..6a875939ba 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.6-alpha-37546'; +$wp_version = '4.6-alpha-37547'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-signup.php b/wp-signup.php index fa2c6780a3..ac20734c0c 100644 --- a/wp-signup.php +++ b/wp-signup.php @@ -91,11 +91,15 @@ do_action( 'before_signup_form' ); * * @since MU * - * @param string $blogname The new site name - * @param string $blog_title The new site title - * @param array $errors + * @param string $blogname The new site name. + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { + if ( ! is_wp_error( $errors ) ) { + $errors = new WP_Error(); + } + $current_site = get_current_site(); // Blog name if ( !is_subdomain_install() ) @@ -183,7 +187,7 @@ function show_blog_form( $blogname = '', $blog_title = '', $errors = '' ) { * * @since 3.0.0 * - * @param array $errors An array possibly containing 'blogname' or 'blog_title' errors. + * @param WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors. */ do_action( 'signup_blogform', $errors ); } @@ -208,11 +212,15 @@ function validate_blog_form() { * * @since MU * - * @param string $user_name The entered username - * @param string $user_email The entered email address - * @param array $errors + * @param string $user_name The entered username. + * @param string $user_email The entered email address. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function show_user_form($user_name = '', $user_email = '', $errors = '') { + if ( ! is_wp_error( $errors ) ) { + $errors = new WP_Error(); + } + // User name echo ''; if ( $errmsg = $errors->get_error_message('user_name') ) { @@ -236,7 +244,7 @@ function show_user_form($user_name = '', $user_email = '', $errors = '') { * * @since 3.0.0 * - * @param array $errors An array possibly containing 'user_name' or 'user_email' errors. + * @param WP_Error $errors A WP_Error object containing containing 'user_name' or 'user_email' errors. */ do_action( 'signup_extra_fields', $errors ); } @@ -257,9 +265,9 @@ function validate_user_form() { * * @since MU * - * @param string $blogname The new site name - * @param string $blog_title The new site title. - * @param array $errors + * @param string $blogname The new site name + * @param string $blog_title The new site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { $current_user = wp_get_current_user(); @@ -282,9 +290,9 @@ function signup_another_blog( $blogname = '', $blog_title = '', $errors = '' ) { * @param array $signup_defaults { * An array of default site sign-up variables. * - * @type string $blogname The site blogname. - * @type string $blog_title The site title. - * @type array $errors An array possibly containing 'blogname' or 'blog_title' errors. + * @type string $blogname The site blogname. + * @type string $blog_title The site title. + * @type WP_Error $errors A WP_Error object possibly containing 'blogname' or 'blog_title' errors. * } */ $filtered_results = apply_filters( 'signup_another_blog_init', $signup_defaults ); @@ -477,9 +485,9 @@ function confirm_another_blog_signup( $domain, $path, $blog_title, $user_name, $ * * @since MU * - * @param string $user_name The username - * @param string $user_email The user's email - * @param array $errors + * @param string $user_name The username. + * @param string $user_email The user's email. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { global $active_signup; @@ -503,9 +511,9 @@ function signup_user( $user_name = '', $user_email = '', $errors = '' ) { * @param array $signup_user_defaults { * An array of default user variables. * - * @type string $user_name The user username. - * @type string $user_email The user email address. - * @type array $errors An array of possible errors relevant to the sign-up user. + * @type string $user_name The user username. + * @type string $user_email The user email address. + * @type WP_Error $errors A WP_Error object with possible errors relevant to the sign-up user. * } */ $filtered_results = apply_filters( 'signup_user_init', $signup_user_defaults ); @@ -599,11 +607,11 @@ function confirm_user_signup($user_name, $user_email) { * * @since MU * - * @param string $user_name The username - * @param string $user_email The user's email address - * @param string $blogname The site name - * @param string $blog_title The site title - * @param array $errors + * @param string $user_name The username. + * @param string $user_email The user's email address. + * @param string $blogname The site name. + * @param string $blog_title The site title. + * @param WP_Error|string $errors A WP_Error object containing existing errors. Defaults to empty string. */ function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_title = '', $errors = '') { if ( !is_wp_error($errors) ) @@ -625,11 +633,11 @@ function signup_blog($user_name = '', $user_email = '', $blogname = '', $blog_ti * @param array $signup_blog_defaults { * An array of default site creation variables. * - * @type string $user_name The user username. - * @type string $user_email The user email address. - * @type string $blogname The blogname. - * @type string $blog_title The title of the site. - * @type array $errors An array of possible errors relevant to new site creation variables. + * @type string $user_name The user username. + * @type string $user_email The user email address. + * @type string $blogname The blogname. + * @type string $blog_title The title of the site. + * @type WP_Error $errors A WP_Error object with possible errors relevant to new site creation variables. * } */ $filtered_results = apply_filters( 'signup_blog_init', $signup_blog_defaults );