Skip to content
  • Log In
  • Register
WordPress.org
  • News
  • Download & Extend
    • Get WordPress
    • Themes
    • Patterns
    • Plugins
    • Openverse
    • Mobile
    • Hosting
  • Learn
    • Learn WordPress
    • Documentation
    • Forums
    • WordPress.tv
    • Developers
  • Community
    • Make WordPress
    • WordCamp
    • Meetups
    • Photo Directory
    • Job Board
    • Five for the Future
  • About
    • About WordPress
    • Showcase
    • Gutenberg
    • Enterprise
  • Get WordPress
Get WordPress

Developer Resources

Browse: Home / Reference / Functions / validate_another_blog_signup()

validate_another_blog_signup(): null|bool

Validates a new site sign-up for an existing user.

Contents

  • Return
  • Source
  • Hooks
  • Related
    • Uses
  • Changelog
  • User Contributed Notes

Return

null|bool True if site signup was validated, false on error.
The function halts all execution if the user is not logged in.


Top ↑

Source

File: wp-signup.php. View all references

function validate_another_blog_signup() {
	global $blogname, $blog_title, $errors, $domain, $path;
	$current_user = wp_get_current_user();
	if ( ! is_user_logged_in() ) {
		die();
	}

	$result = validate_blog_form();

	// Extracted values set/overwrite globals.
	$domain     = $result['domain'];
	$path       = $result['path'];
	$blogname   = $result['blogname'];
	$blog_title = $result['blog_title'];
	$errors     = $result['errors'];

	if ( $errors->has_errors() ) {
		signup_another_blog( $blogname, $blog_title, $errors );
		return false;
	}

	$public = (int) $_POST['blog_public'];

	$blog_meta_defaults = array(
		'lang_id' => 1,
		'public'  => $public,
	);

	// Handle the language setting for the new site.
	if ( ! empty( $_POST['WPLANG'] ) ) {

		$languages = signup_get_available_languages();

		if ( in_array( $_POST['WPLANG'], $languages, true ) ) {
			$language = wp_unslash( sanitize_text_field( $_POST['WPLANG'] ) );

			if ( $language ) {
				$blog_meta_defaults['WPLANG'] = $language;
			}
		}
	}

	/**
	 * Filters the new site meta variables.
	 *
	 * Use the {@see 'add_signup_meta'} filter instead.
	 *
	 * @since MU (3.0.0)
	 * @deprecated 3.0.0 Use the {@see 'add_signup_meta'} filter instead.
	 *
	 * @param array $blog_meta_defaults An array of default blog meta variables.
	 */
	$meta_defaults = apply_filters_deprecated( 'signup_create_blog_meta', array( $blog_meta_defaults ), '3.0.0', 'add_signup_meta' );

	/**
	 * Filters the new default site meta variables.
	 *
	 * @since 3.0.0
	 *
	 * @param array $meta {
	 *     An array of default site meta variables.
	 *
	 *     @type int $lang_id     The language ID.
	 *     @type int $blog_public Whether search engines should be discouraged from indexing the site. 1 for true, 0 for false.
	 * }
	 */
	$meta = apply_filters( 'add_signup_meta', $meta_defaults );

	$blog_id = wpmu_create_blog( $domain, $path, $blog_title, $current_user->ID, $meta, get_current_network_id() );

	if ( is_wp_error( $blog_id ) ) {
		return false;
	}

	confirm_another_blog_signup( $domain, $path, $blog_title, $current_user->user_login, $current_user->user_email, $meta, $blog_id );
	return true;
}

View on Trac View on GitHub


Top ↑

Hooks

apply_filters( 'add_signup_meta', array $meta )

Filters the new default site meta variables.

apply_filters_deprecated( 'signup_create_blog_meta', array $blog_meta_defaults )

Filters the new site meta variables.


Top ↑

Related

Top ↑

Uses

Uses
Uses Description
get_current_network_id() wp-includes/load.php

Retrieves the current network ID.

apply_filters_deprecated() wp-includes/plugin.php

Fires functions attached to a deprecated filter hook.

signup_get_available_languages() wp-signup.php

Retrieves languages available during the site/user sign-up process.

signup_another_blog() wp-signup.php

Shows a form for returning users to sign up for another site.

confirm_another_blog_signup() wp-signup.php

Shows a message confirming that the new site has been created.

validate_blog_form() wp-signup.php

Validates the new site sign-up.

sanitize_text_field() wp-includes/formatting.php

Sanitizes a string from user input or from the database.

wp_get_current_user() wp-includes/pluggable.php

Retrieves the current user object.

wpmu_create_blog() wp-includes/ms-functions.php

Creates a site.

wp_unslash() wp-includes/formatting.php

Removes slashes from a string or recursively removes slashes from strings within an array.

is_user_logged_in() wp-includes/pluggable.php

Determines whether the current visitor is a logged in user.

apply_filters() wp-includes/plugin.php

Calls the callback functions that have been added to a filter hook.

is_wp_error() wp-includes/load.php

Checks whether the given variable is a WordPress Error.

Show 8 more uses Hide more uses

Top ↑

Changelog

Changelog
Version Description
MU (3.0.0) Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.

  • About
  • News
  • Hosting
  • Donate
  • Swag
  • Documentation
  • Developers
  • Get Involved
  • Learn
  • Showcase
  • Plugins
  • Themes
  • Patterns
  • WordCamp
  • WordPress.TV
  • BuddyPress
  • bbPress
  • WordPress.com
  • Matt
  • Privacy
  • Public Code
WordPress.org
WordPress.org
  • Visit our Facebook page
  • Visit our Twitter account
  • Visit our Instagram account
  • Visit our LinkedIn account
Code is Poetry

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.