MediaWiki master
MediaWiki\Hook\UserLoginCompleteHook Interface Reference

This is a hook handler interface, see docs/Hooks.md. More...

Inherited by MediaWiki\Api\ApiHookRunner, and MediaWiki\HookContainer\HookRunner.

Public Member Functions

 onUserLoginComplete ( $user, &$inject_html, $direct)
 Use this hook to show custom content after a user has logged in via the web interface.
 

Detailed Description

This is a hook handler interface, see docs/Hooks.md.

Use the hook name "UserLoginComplete" to register handlers implementing this interface.

Stability: stable
to implement

Definition at line 14 of file UserLoginCompleteHook.php.

Member Function Documentation

◆ onUserLoginComplete()

MediaWiki\Hook\UserLoginCompleteHook::onUserLoginComplete ( $user,
& $inject_html,
$direct )

Use this hook to show custom content after a user has logged in via the web interface.

This includes both login and signup. It's also called by the action=login API (but not action=clientlogin or action=createaccount) for legacy reasons.

For functionality that needs to run after any login (API or web) use UserLoggedIn.

Before 1.42 this hook was also called when the user visited the login page with a returnto parameter while already logged in. Code that needs to run in that situation should use the PostLoginRedirect hook instead.

Since
1.35
Parameters
User$userThe user object that was created on login
string&$inject_htmlAny HTML to inject after the "logged in" message. (Setting it to a non-empty value will also prevent redirects: instead of the user being sent back to the page indicated by the returnto URL parameter, they will see a success page with $inject_html and a link to the returnto page.) On signup, the BeforeWelcomeCreation hook can further modify this value.
bool$direct(bool) Unused, always true. Before 1.42, it was false when the hook was called in situations other than a successful login or signup; since 1.42 those don't happen anymore.
Returns
bool|void True or no return value to continue or false to abort
See also
BeforeWelcomeCreationHook::onBeforeWelcomeCreation

Implemented in MediaWiki\Api\ApiHookRunner, and MediaWiki\HookContainer\HookRunner.


The documentation for this interface was generated from the following file: