diff --git a/Languages/en_US/Who.php b/Languages/en_US/Who.php index 98b3dd872b..1ffd337d09 100644 --- a/Languages/en_US/Who.php +++ b/Languages/en_US/Who.php @@ -18,7 +18,6 @@ $txt['who_no_online_spiders'] = 'There are currently no robots online.'; $txt['who_no_online_guests'] = 'There are currently no guests online.'; $txt['who_no_online_members'] = 'There are currently no members online.'; -$txt['who_guest_login'] = 'User has been taken to the login page.'; $txt['whospider_login'] = 'Viewing the login page.'; $txt['whospider_register'] = 'Viewing the registration page.'; diff --git a/Sources/Actions/Who.php b/Sources/Actions/Who.php index ced23c786e..8ed5b5837e 100644 --- a/Sources/Actions/Who.php +++ b/Sources/Actions/Who.php @@ -523,7 +523,7 @@ public static function determineActions(mixed $urls, string|bool $preferred_pref if (isset($actions['error'])) { $error_message = Lang::getTxt( - $actions['error'] == 'guest_login' ? 'who_guest_login' : $actions['error'], + $actions['error'], (array) ($actions['error_params'] ?? []), file: 'Who+Errors', ); diff --git a/Sources/Forum.php b/Sources/Forum.php index 1b641f8dcf..4cbe253987 100644 --- a/Sources/Forum.php +++ b/Sources/Forum.php @@ -629,32 +629,6 @@ protected function preflight(): void ErrorHandler::fatalLang('not_a_topic', false); } - // Don't log if this is an attachment, avatar, toggle of editor buttons, - // theme option, XML feed, popup, etc. - if ( - self::$current_action?->canBeLogged() === true - || ( - self::$current_action === null - && !QueryString::isFilteredRequest(self::$unlogged_actions, 'action') - ) - ) { - // Log this user as online. - User::$me->logOnline(); - - // Track forum statistics and hits...? - if (!empty(Config::$modSettings['hitStats'])) { - Logging::trackStats(['hits' => '+']); - } - - // Login cookies should only expire after a period of inactivity. - // Since doing something worthy of logging means this member is - // actively engaged with the forum right now, refresh their login - // cookie in order to reset the countdown to its expiry date. - if (!User::$me->is_guest) { - Cookie::updateLoginCookieExpiry(); - } - } - // Make sure that our scheduled tasks have been running as intended. Config::checkCron(); @@ -682,6 +656,32 @@ protected function preflight(): void ) { User::$me->kickIfGuest(null, false); } + + // Don't log if this is an attachment, avatar, toggle of editor buttons, + // theme option, XML feed, popup, etc. + if ( + self::$current_action?->canBeLogged() === true + || ( + self::$current_action === null + && !QueryString::isFilteredRequest(self::$unlogged_actions, 'action') + ) + ) { + // Log this user as online. + User::$me->logOnline(); + + // Track forum statistics and hits...? + if (!empty(Config::$modSettings['hitStats'])) { + Logging::trackStats(['hits' => '+']); + } + + // Login cookies should only expire after a period of inactivity. + // Since doing something worthy of logging means this member is + // actively engaged with the forum right now, refresh their login + // cookie in order to reset the countdown to its expiry date. + if (!User::$me->is_guest) { + Cookie::updateLoginCookieExpiry(); + } + } } /** diff --git a/Sources/User.php b/Sources/User.php index f8208a36ad..cfa6350eb4 100644 --- a/Sources/User.php +++ b/Sources/User.php @@ -1547,10 +1547,6 @@ public function kickIfGuest(?string $message = null, bool $log = true): void // Log what they were trying to do that didn't work. if ($log) { - if (!empty(Config::$modSettings['who_enabled'])) { - $_GET['error'] = 'guest_login'; - } - $this->logOnline(true); }