Make WordPress Core

Opened 10 years ago

Closed 9 years ago

#17306 closed defect (bug) (fixed)

The filter wpmu_validate_blog_signup cannot is not passed enough parameters

Reported by: BrianLayman Owned by: nacin
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);

$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.

Attachments (1)

17306.patch (694 bytes) - added by jakub.tyrcha 10 years ago.

Download all attachments as: .zip

Change History (6)

10 years ago

#1 @jakub.tyrcha
10 years ago

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

#2 @dd32
10 years ago

  • Description modified (diff)
  • Keywords has-patch added

#3 @SergeyBiryukov
10 years ago

  • Component changed from General to Multisite

#4 @wonderboymusic
9 years ago

  • Milestone changed from Awaiting Review to 3.5

There are a lot of these Multisite one-liners out there. Bumping up.

#5 @nacin
9 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [21860]:

Pass the user parameter to the wpmu_validate_blog_signup filter and wpmu_validate_blog_signup()'s return array. props BrianLayman. fixes #17306.

Note: See TracTickets for help on using tickets.