Manual:Hooks/PostLoginRedirect

From mediawiki.org
PostLoginRedirect
Available from version 1.24.0
Occurs after signing up or logging in, allows for interception of redirect.
Define function:
public static function onPostLoginRedirect( &$returnTo, &$returnToQuery, &$type ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"PostLoginRedirect": "MyExtensionHooks::onPostLoginRedirect"
	}
}
Called from: File(s): specials/helpers/LoginHelper.php, specials/SpecialUserLogin.php
Interface: PostLoginRedirectHook.php

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


Details[edit]

  • $returnTo: The page name to return to, as a string
  • $returnToQuery: array of url parameters, mapping parameter names to values
  • $type: type of login redirect as string, which can be one of:
    • error: display a return to link ignoring $wgRedirectOnLogin
    • signup: display a return to link using $wgRedirectOnLogin if needed
    • success: display a return to link using $wgRedirectOnLogin if needed
    • successredirect: send an HTTP redirect using $wgRedirectOnLogin if needed

The function should return true to continue hook processing or false to abort.