(bug 30444) Add variables user_name and user_groups for action createaccount. Patch by Beau

This commit is contained in:
John Du Hart 2011-08-24 00:29:26 +00:00
parent e6e286ba31
commit 0f274e5b32
Notes: Raimond Spekking 2012-03-12 20:46:25 +00:00
2 changed files with 12 additions and 1 deletions

View file

@ -1523,7 +1523,12 @@ class AbuseFilter {
$vars->setVar( 'ACTION', 'createaccount' );
$name = Title::makeTitle( $row->rc_namespace, $row->rc_title )->getText();
$vars->setVar( 'user_name', $name );
// Add user data if the account was created by a registered user
if ( $row->rc_user && $name != $row->rc_user_text ) {
$user = User::newFromName( $row->rc_user_text );
$vars->addHolder( self::generateUserVars( $user ) );
}
$vars->setVar( 'accountname', $name );
return $vars;
}

View file

@ -105,6 +105,12 @@ class AbuseFilterHooks {
return false;
}
$vars = new AbuseFilterVariableHolder;
// Add variables only for a registered user, so IP addresses of
// new users won't be exposed
global $wgUser;
if ( $wgUser->getId() ) {
$vars->addHolder( AbuseFilter::generateUserVars( $wgUser ) );
}
$vars->setVar( 'ACTION', 'createaccount' );
$vars->setVar( 'ACCOUNTNAME', $user->getName() );