Manuel:Accroches/LocalUserCreated
LocalUserCreated | |
---|---|
Disponible depuis version 1.26.0 Appelé immédiatement après qu'un utilisateur local a été créé et enregistré dans la base de données | |
Fonction à définir : | public static function onLocalUserCreated( $user, $autocreated ) { ... }
|
Attacher l'accroche : | Dans extension.json :
{
"Hooks": {
"LocalUserCreated": "MediaWiki\\Extension\\MyExtension\\Hooks::onLocalUserCreated"
}
}
|
Appelé de : | Fichier(s) : auth/AuthManager.php |
Interface : | LocalUserCreatedHook.php |
Pour plus d'information sur l'ajout des accroches (hooks), voir Accroches .
Pour des exemples d'extensions utilisant cette accroche, voir Category:LocalUserCreated extensions/fr .
Details
- $user - User object for the created user
- $autocreated - Boolean, whether this was an auto-creation. Note if your wiki uses CentralAuth this will always be true.
Notes
Added in MediaWiki 1.26 as part of the AuthManager system.
Replaces the AuthPlugin::initUser()
method call and the AddNewAccount and AuthPluginAutoCreate hooks.
Extensions which implement their own authentication provider might want to use AuthManager::autoCreatedAccount
and AuthManager::postAccountCreation
instead, which are similar but have access to more information.
(Note that postAccountCreation
is called significantly later in the process, after secondary authentication providers have finished.)
Changes which are not immediately required for database consistency should probably be deferred; see Database transactions .
If $wgAutoCreateTempUser is active, this hook is also called when a temporary account is automatically created for a logged-out user.