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
    • WordPress Swag Store
  • Get WordPress
Get WordPress

Developer Resources

Browse: Home / Reference / Functions / validate_blog_signup()

validate_blog_signup(): bool

Validates new site signup.

Contents

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

Return

bool True if the site sign-up was validated, false on error.


Top ↑

Source

File: wp-signup.php. View all references

function validate_blog_signup() {
	// Re-validate user info.
	$user_result = wpmu_validate_user_signup( $_POST['user_name'], $_POST['user_email'] );
	$user_name   = $user_result['user_name'];
	$user_email  = $user_result['user_email'];
	$user_errors = $user_result['errors'];

	if ( $user_errors->has_errors() ) {
		signup_user( $user_name, $user_email, $user_errors );
		return false;
	}

	$result     = wpmu_validate_blog_signup( $_POST['blogname'], $_POST['blog_title'] );
	$domain     = $result['domain'];
	$path       = $result['path'];
	$blogname   = $result['blogname'];
	$blog_title = $result['blog_title'];
	$errors     = $result['errors'];

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

	$public      = (int) $_POST['blog_public'];
	$signup_meta = 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 ) {
				$signup_meta['WPLANG'] = $language;
			}
		}
	}

	/** This filter is documented in wp-signup.php */
	$meta = apply_filters( 'add_signup_meta', $signup_meta );

	wpmu_signup_blog( $domain, $path, $blog_title, $user_name, $user_email, $meta );
	confirm_blog_signup( $domain, $path, $blog_title, $user_name, $user_email, $meta );
	return true;
}

View on Trac View on GitHub


Top ↑

Hooks

apply_filters( 'add_signup_meta', array $meta )

Filters the new default site meta variables.


Top ↑

Related

Top ↑

Uses

Uses
Uses Description
signup_get_available_languages() wp-signup.php

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

signup_user() wp-signup.php

Shows a form for a visitor to sign up for a new user account.

signup_blog() wp-signup.php

Shows a form for a user or visitor to sign up for a new site.

confirm_blog_signup() wp-signup.php

Shows a message confirming that the new site has been registered and is awaiting activation.

sanitize_text_field() wp-includes/formatting.php

Sanitizes a string from user input or from the database.

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

Sanitizes and validates data required for a user sign-up.

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

Processes new site registrations.

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

Records site signup information for future activation.

wp_unslash() wp-includes/formatting.php

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

apply_filters() wp-includes/plugin.php

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

Show 5 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.