Opened 14 years ago
Closed 12 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 )
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.
why not just add the 'user' parameter in the end?