Extension:CentralAuth/Hooks/CentralAuthPostLoginRedirect

CentralAuthPostLoginRedirect
Available from version 1.22 (Gerrit change 73449)
Allows extensions to modify the redirect location after the user has finished logging in to their account.
Define function:
public static function onCentralAuthPostLoginRedirect( string &$returnTo, string &$returnToQuery, bool $stickHttps, string $type, string &$injectHtml ) { ... }
Attach hook:
$wgHooks['CentralAuthPostLoginRedirect'][] = 'MyExtensionHooks::onCentralAuthPostLoginRedirect';
Called from:File(s): CentralAuth / includes/specials/SpecialCentralLogin.php
Function(s): doLoginComplete

For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:CentralAuthPostLoginRedirect extensions.

Login and signup links will usually set the returnto and returntoquery URL parameters so that after login / signup the user can be returned to where they were. This hook allows extensions to change the return target to a particular welcome page or provide an extra query string parameter. Extensions which do override the returnTo should probably add the original to the returnToQuery parameter, so that they can display a "[Thanks, now take me back to wherever]" link.

Extensions that add HTML to the "success" form page after login or account creation by hooking UserLoginComplete or BeforeWelcomeCreation will probably need to hook this to achieve similar results if CentralAuth is in use.

If there is no returnto parameter to the login or create account form, and no extension changes the link, CentralAuth redirects to the default page of the wiki.

Parameters edit

  • &$returnTo: A modifiable string representing the page title to redirect to. The CentralAuth extension sets this to the returnto query string parameter that was passed to the login or create account form (if any); extensions can replace it with another page.
  • &$returnToQuery: A modifiable string representing the URL parameters to use for the returning query. The extension sets this to the returntoquery query string parameter that was passed to the login or create account form (if any); extensions can replace or add to it.
  • $stickHttps: A bool representing whether or not the redirect link will continue to use HTTPS. See $wgSecureLogin .
  • $type: signup during signup, empty string otherwise.
  • &$injectHtml: A modifiable string representing the HTML to show on the login success page. Set to empty string to skip the success page and redirect to $returnTo immediately.

See also edit