Make WordPress Core

Changeset 52655


Ignore:
Timestamp:
01/31/2022 01:05:22 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Docs: Add a comment to clarify the username_exists() check in wpmu_validate_blog_signup().

Creating a new site that matches an existing user's login name is not allowed, unless it's the user's own username.

Follow-up to mu:550, mu:1364.

Props henry.wright, joyously, swissspidy, SergeyBiryukov.
Fixes #54326.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/ms-functions.php

    r52299 r52655  
    683683    }
    684684
    685     // Do not allow users to create a blog that conflicts with a page on the main blog.
     685    // Do not allow users to create a site that conflicts with a page on the main blog.
    686686    if ( ! is_subdomain_install() && $wpdb->get_var( $wpdb->prepare( 'SELECT post_name FROM ' . $wpdb->get_blog_prefix( $current_network->site_id ) . "posts WHERE post_type = 'page' AND post_name = %s", $blogname ) ) ) {
    687687        $errors->add( 'blogname', __( 'Sorry, you may not use that site name.' ) );
     
    723723    }
    724724
     725    /*
     726     * Do not allow users to create a site that matches an existing user's login name,
     727     * unless it's the user's own username.
     728     */
    725729    if ( username_exists( $blogname ) ) {
    726730        if ( ! is_object( $user ) || ( is_object( $user ) && ( $user->user_login != $blogname ) ) ) {
Note: See TracChangeset for help on using the changeset viewer.