[wp-trac] [WordPress Trac] #17306: The filter wpmu_validate_blog_signup cannot is not passed enough parameters
WordPress Trac
wp-trac at lists.automattic.com
Tue Jul 12 06:59:50 UTC 2011
#17306: The filter wpmu_validate_blog_signup cannot is not passed enough parameters
--------------------------+------------------------------
Reporter: BrianLayman | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 3.1
Severity: normal | Resolution:
Keywords: has-patch |
--------------------------+------------------------------
Changes (by dd32):
* keywords: => has-patch
Old 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.
New 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.
--
--
Ticket URL: <http://core.trac.wordpress.org/ticket/17306#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list