validate_another_blog_signup(): null|bool
- Since
- MU (3.0.0)
- Source
wp-signup.php:431
Compatibility
- WordPress
- since MU (3.0.0)
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Return value
null|bool- True if site signup was validated, false on error.
The function halts all execution if the user is not logged in.
Performance profile
How much work a call to validate_another_blog_signup() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Light
- Scaling
- Constant
- Instructions
- 33–103
- Plugin surface
- 2 hooks
- Called by
- 0
Only touches the object cache, via wp_cache_set_sites_last_changed().
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 110.
Third-party callbacks on 'signup_create_blog_meta', 'add_signup_meta' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
apply_filters_deprecated()called directly - cacheobject cache
wp_cache_set_sites_last_changed()one call below validate_another_blog_signup()
Further down the call graph this can also reach option, query, serialize, transient and http. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 14 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost validate_another_blog_signup() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
is_user_logged_in() && ->has_errors() | 33 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), signup_another_blog() |
!is_user_logged_in() && ->has_errors() | 35 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), signup_another_blog() |
is_user_logged_in() && !->has_errors() && empty($value) && is_wp_error() | 67 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
!is_user_logged_in() && !->has_errors() && empty($value) && is_wp_error() | 69 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
is_user_logged_in() && !->has_errors() && !empty($value) && !$languages && is_wp_error() | 75 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
!is_user_logged_in() && !->has_errors() && !empty($value) && !$languages && is_wp_error() | 77 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
is_user_logged_in() && !->has_errors() && empty($value) && !is_wp_error() | 80 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
!is_user_logged_in() && !->has_errors() && empty($value) && !is_wp_error() | 82 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
is_user_logged_in() && !->has_errors() && !empty($value) && $languages && is_wp_error() | 86–88 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), sanitize_text_field(), wp_unslash(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
is_user_logged_in() && !->has_errors() && !empty($value) && !$languages && !is_wp_error() | 88 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
!is_user_logged_in() && !->has_errors() && !empty($value) && $languages && is_wp_error() | 88–90 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), sanitize_text_field(), wp_unslash(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error() |
!is_user_logged_in() && !->has_errors() && !empty($value) && !$languages && !is_wp_error() | 90 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
2 further outcomes, up to 103 instructions
is_user_logged_in() && !->has_errors() && !empty($value) && $languages && !is_wp_error() | 99–101 | wp_get_current_user(), is_user_logged_in(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), sanitize_text_field(), wp_unslash(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
!is_user_logged_in() && !->has_errors() && !empty($value) && $languages && !is_wp_error() | 101–103 | wp_get_current_user(), is_user_logged_in(), exit(), validate_blog_form(), ->has_errors(), signup_get_available_languages(), sanitize_text_field(), wp_unslash(), apply_filters(), get_current_network_id(), wpmu_create_blog(), is_wp_error(), confirm_another_blog_signup() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 110 | 33–103 | 6 | |
| 8.5 | 110 | 33–103 | 6 | |
| 8.4 | 110 | 33–103 | 6 | 2 fewer instructions than PHP 8.3 |
| 8.3 | 112 | 12–104 | 6 | |
| 8.2 | 112 | 12–104 | 6 | |
| 8.1 | 112 | 12–104 | 6 | |
| 7.4 | 112 | 12–104 | 6 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 2
2 hooks fire while validate_another_blog_signup() runs, in this order:
- do_action( signup_create_blog_meta )filter_deprecatedline 483 (+52 into the body)
Filters the new site meta variables.
- apply_filters( add_signup_meta )filterline 497 (+66 into the body)
Filters the new default site meta variables.
Uses · 13
- wp_get_current_user()Retrieves the current user object.
- is_user_logged_in()Determines whether the current visitor is a logged in user.
- validate_blog_form()Validates the new site sign-up.
- signup_another_blog()Shows a form for returning users to sign up for another site.
- signup_get_available_languages()Retrieves languages available during the site/user sign-up process.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- sanitize_text_field()Sanitizes a string from user input or from the database.
- apply_filters_deprecated()Fires functions attached to a deprecated filter hook.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wpmu_create_blog()Creates a site.
- get_current_network_id()Retrieves the current network ID.
- is_wp_error()Checks whether the given variable is a WordPress Error.
Show all 13
- confirm_another_blog_signup()Shows a message confirming that the new site has been created.
Source code
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;}Changelog
Introduced in MU (3.0.0). Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-signup.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.