Make WordPress Core

Changeset 40295


Ignore:
Timestamp:
03/17/2017 02:35:08 PM (10 years ago)
Author:
flixos90
Message:

Multisite: Remove restriction of minimum site name length in wpmu_validate_blog_signup().

It is sometimes desirable to support shorter site names than 4 characters, therefore that restriction should be removed. It is still possible to manually enforce it by using the wpmu_validate_blog_signup filter.

As a result of this change, another is_super_admin() call gets removed which affects the ongoing efforts of working on a network-wide role system.

Props milindmore22.
Fixes #39676. See #37616.

Location:
trunk
Files:
2 edited

Legend:

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

    r39920 r40295  
    576576        if ( in_array( $blogname, $illegal_names ) )
    577577                $errors->add('blogname',  __( 'That name is not allowed.' ) );
    578 
    579         if ( strlen( $blogname ) < 4 && !is_super_admin() )
    580                 $errors->add('blogname',  __( 'Site name must be at least 4 characters.' ) );
    581578
    582579        // do not allow users to create a blog that conflicts with a page on the main blog.
  • trunk/tests/phpunit/tests/multisite/wpmuValidateBlogSignup.php

    r40294 r40295  
    6767                );
    6868
    69                 if ( ! is_super_admin() ) {
    70                         $data[] = array( 'foo', 'Site names must at least contain 4 characters.' );
    71                 }
    72 
    7369                $illegal_names = get_site_option( 'illegal_names' );
    7470                if ( ! empty( $illegal_names ) ) {
    … …  
    9086                $this->assertEmpty( $result['errors']->get_error_codes() );
    9187        }
     88
     89        /**
     90         * @ticket 39676
     91         */
     92        public function test_validate_short_blogname() {
     93                $result = wpmu_validate_blog_signup( 'foo', 'Foo Site Title', get_userdata( self::$super_admin_id ) );
     94                $this->assertEmpty( $result['errors']->get_error_codes() );
     95        }
    9296}
    9397
Note: See TracChangeset for help on using the changeset viewer.