Make WordPress Core

Opened 7 years ago

Last modified 6 years ago

#17306 closed defect (bug)

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

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

Description (last modified by dd32)

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 (3)

7 years ago

#1 @jakub.tyrcha
7 years ago

why not just add the 'user' parameter in the end?

#2 @dd32
7 years ago

  • Description modified (diff)
  • Keywords has-patch added
Note: See TracTickets for help on using tickets.