return false;
}
- // Reject various classes of invalid names
- $name = AuthManager::callLegacyAuthPlugin(
- 'getCanonicalName', [ $t->getText() ], $t->getText()
- );
+ $name = $t->getText();
switch ( $validate ) {
case false:
// update groups in external authentication database
Hooks::run( 'UserGroupsChanged', [ $this, $toPromote, [], false, false, $oldUGMs, $newUGMs ] );
- AuthManager::callLegacyAuthPlugin( 'updateExternalDBGroups', [ $this, $toPromote ] );
$logEntry = new ManualLogEntry( 'rights', 'autopromote' );
$logEntry->setPerformer( $this );
if ( $this->mLocked !== null ) {
return $this->mLocked;
}
- // Avoid PHP 7.1 warning of passing $this by reference
- $user = $this;
- $authUser = AuthManager::callLegacyAuthPlugin( 'getUserInstance', [ &$user ], null );
- $this->mLocked = $authUser && $authUser->isLocked();
+ // Reset for hook
+ $this->mLocked = false;
Hooks::run( 'UserIsLocked', [ $this, &$this->mLocked ] );
return $this->mLocked;
}
}
$this->getBlockedStatus();
if ( !$this->mHideName ) {
- // Avoid PHP 7.1 warning of passing $this by reference
- $user = $this;
- $authUser = AuthManager::callLegacyAuthPlugin( 'getUserInstance', [ &$user ], null );
- $this->mHideName = $authUser && $authUser->isHidden();
+ // Reset for hook
+ $this->mHideName = false;
Hooks::run( 'UserIsHidden', [ $this, &$this->mHideName ] );
}
return (bool)$this->mHideName;
if ( $type == 'created' || $type === false ) {
$message = 'confirmemail_body';
+ $type = 'created';
} elseif ( $type === true ) {
$message = 'confirmemail_body_changed';
+ $type = 'changed';
} else {
// Messages: confirmemail_body_changed, confirmemail_body_set
$message = 'confirmemail_body_' . $type;
}
- return $this->sendMail( wfMessage( 'confirmemail_subject' )->text(),
- wfMessage( $message,
+ $mail = [
+ 'subject' => wfMessage( 'confirmemail_subject' )->text(),
+ 'body' => wfMessage( $message,
$this->getRequest()->getIP(),
$this->getName(),
$url,
$wgLang->userTimeAndDate( $expiration, $this ),
$invalidateURL,
$wgLang->userDate( $expiration, $this ),
- $wgLang->userTime( $expiration, $this ) )->text() );
+ $wgLang->userTime( $expiration, $this ) )->text(),
+ 'from' => null,
+ 'replyTo' => null,
+ ];
+ $info = [
+ 'type' => $type,
+ 'ip' => $this->getRequest()->getIP(),
+ 'confirmURL' => $url,
+ 'invalidateURL' => $invalidateURL,
+ 'expiration' => $expiration
+ ];
+
+ Hooks::run( 'UserSendConfirmationMail', [ $this, &$mail, $info ] );
+ return $this->sendMail( $mail['subject'], $mail['body'], $mail['from'], $mail['replyTo'] );
}
/**
* @param string $body Message body
* @param User|null $from Optional sending user; if unspecified, default
* $wgPasswordSender will be used.
- * @param string|null $replyto Reply-To address
+ * @param MailAddress|null $replyto Reply-To address
* @return Status
*/
public function sendMail( $subject, $body, $from = null, $replyto = null ) {