| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use MediaWiki\User\User; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "UserLoginComplete" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface UserLoginCompleteHook { |
| 15 | /** |
| 16 | * Use this hook to show custom content after a user has logged in via the web interface. |
| 17 | * This includes both login and signup. It's also called by the action=login API (but not |
| 18 | * action=clientlogin or action=createaccount) for legacy reasons. |
| 19 | * |
| 20 | * For functionality that needs to run after any login (API or web) use UserLoggedIn. |
| 21 | * |
| 22 | * Before 1.42 this hook was also called when the user visited the login page with a returnto |
| 23 | * parameter while already logged in. Code that needs to run in that situation should use the |
| 24 | * PostLoginRedirect hook instead. |
| 25 | * |
| 26 | * @since 1.35 |
| 27 | * |
| 28 | * @param User $user The user object that was created on login |
| 29 | * @param string &$inject_html Any HTML to inject after the "logged in" message. (Setting it |
| 30 | * to a non-empty value will also prevent redirects: instead of the user being sent back to |
| 31 | * the page indicated by the returnto URL parameter, they will see a success page with |
| 32 | * $inject_html and a link to the returnto page.) |
| 33 | * On signup, the BeforeWelcomeCreation hook can further modify this value. |
| 34 | * @param bool $direct (bool) Unused, always true. Before 1.42, it was false when the hook |
| 35 | * was called in situations other than a successful login or signup; since 1.42 those don't |
| 36 | * happen anymore. |
| 37 | * @return bool|void True or no return value to continue or false to abort |
| 38 | * @see BeforeWelcomeCreationHook::onBeforeWelcomeCreation |
| 39 | */ |
| 40 | public function onUserLoginComplete( $user, &$inject_html, $direct ); |
| 41 | } |