WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 19 months ago

#17306 closed defect (bug)

The filter wpmu_validate_blog_signup cannot is not passed enough parameters — at Initial Version

Reported by: BrianLayman Owned by:
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.1
Component: Multisite Keywords: has-patch
Focuses: Cc:

Description

The function call wpmu_validate_blog_signup is passed $blogname, $blog_title and $user

When writing a plugin using the wpmu_validate_blog_signup filter to replace the existing check, you cannot handle the condition of the blogname being that of an existing user that is not the current logged in user.
e.g. this section of code from the original function:

if ( username_exists( $blogname ) ) {

if ( is_object( $user ) == false
( is_object($user) && ( $user->user_login != $blogname ) ) )

$errors->add( 'blogname', ( 'Sorry, that site is reserved!' ) );

}

The original functions should perhaps replace the line:
$result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors);

with:
$result = array('domain' => $mydomain, 'path' => $path, 'blogname' => $blogname, 'blog_title' => $blog_title, 'user' => $user, 'errors' => $errors);

The only problem I see with this is the possibility of some plugin referencing the fifth position of $result by numeric index instead of by name, which would be a really wrong thing to do. So I think this implementation should not be a problem.

Change History (1)

jakub.tyrcha3 years ago

Note: See TracTickets for help on using tickets.