From 5314c2bddf075ed4ab78ce49f6e92560c8a25c8d Mon Sep 17 00:00:00 2001 From: david63 Date: Fri, 19 Sep 2014 14:11:05 +0100 Subject: [PATCH] [ticket/12985] Add core.login_box_redirect Add core.login_box_redirect core event to allow extensions to redirect a user to a specific page when logging in. PHPBB3-12985 --- phpBB/includes/functions.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a61518401c..33caacf0aa 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2748,7 +2748,7 @@ function confirm_box($check, $title = '', $hidden = '', $html_body = 'confirm_bo function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = false, $s_display = true) { global $db, $user, $template, $auth, $phpEx, $phpbb_root_path, $config; - global $request, $phpbb_container; + global $request, $phpbb_container, $phpbb_dispatcher; $err = ''; @@ -2834,6 +2834,18 @@ function login_box($redirect = '', $l_explain = '', $l_success = '', $admin = fa { $redirect = request_var('redirect', "{$phpbb_root_path}index.$phpEx"); + /** + * This event allows an extension to modify the redirection when a user successfully logs in + * + * @event core.login_box_redirect + * @var string redirect Redirect string + * @var boolean admin Is admin? + * @var bool return If true, do not redirect but return the sanitized URL. + * @since 3.1.0-RC5 + */ + $vars = array('redirect', 'admin', 'return'); + extract($phpbb_dispatcher->trigger_event('core.login_box_redirect', compact($vars))); + // append/replace SID (may change during the session for AOL users) $redirect = reapply_sid($redirect);