Skip to content

[2.1.8]: Activity on pages without action no longer logged. #9785

Closed

Description

@Thidox

Basic Information

Since updating to version 2.1.8 page views of boards and topics (Or any page without an action) are no longer logged. I have traced this back to the change made in e81ea6f.

By moving the logging to after the entire if/else block, it now also sits after the elseif (empty($_REQUEST['action'])) on line 286.
This elseif block however, contains early returns. Which in turn cause the activity logging to never be called for these pages.

Given that the initial 2 if/elseif blocks are valid exemptions for the logging, but the third one is not. And also given that anything that hits the initial 2 if/elseif blocks can never reach the code after due to the early returns present in these blocks. I suggest to change the final elseif into its own if, and move the activity logging to above this if.

        // If guest access is off, a guest can only do one of the very few following actions.
        elseif (empty($modSettings['allow_guestAccess']) && $user_info['is_guest'] && (!isset($_REQUEST['action']) || !in_array($_REQUEST['action'], array('coppa', 'login', 'login2', 'logintfa', 'reminder', 'activate', 'help', 'helpadmin', 'smstats', 'verificationcode', 'signup', 'signup2')))) {
                return 'KickGuest';
        }

        $should_log = !is_filtered_request($no_stat_actions, 'action');
        if ($should_log)
        {
                // Log this user as online.
                writeLog();

                // Track forum statistics and hits...?
                if (!empty($modSettings['hitStats']))
                        trackStats(array('hits' => '+'));
        }
        unset($no_stat_actions);

        if (empty($_REQUEST['action']))
        {
                // Action and board are both empty... BoardIndex! Unless someone else wants to do something different.
                if (empty($board) && empty($topic))
                {
                        if (!empty($modSettings['integrate_default_action']))
                        {
                                $defaultAction = explode(',', $modSettings['integrate_default_action']);

                                // Sorry, only one default action is needed.
                                $defaultAction = $defaultAction[0];

                                $call = call_helper($defaultAction, true);

                                if (!empty($call))
                                        return $call;
                        }

                        // No default action huh? then go to our good old BoardIndex.
                        else
                        {
                                require_once($sourcedir . '/BoardIndex.php');

                                return 'BoardIndex';
                        }
                }

                // Topic is empty, and action is empty.... MessageIndex!
                elseif (empty($topic))
                {
                        require_once($sourcedir . '/MessageIndex.php');
                        return 'MessageIndex';
                }

                // Board is not empty... topic is not empty... action is empty.. Display!
                else
                {
                        require_once($sourcedir . '/Display.php');
                        return 'Display';
                }
        }

Steps to reproduce

  1. Simply open any page that does not have an action in the URL
  2. Observe no change in activity on the "who is online" page, nor any change in the counters on board/topic activity views.

Expected result

No response

Actual result

No response

Version/Git revision

2.1.8

Database Engine

MySQL

Database Version

11.8.9

PHP Version

8.5

Logs

Additional Information

No response

Activity

  1. live627 commented on Oct 19, 2026

    @live627
    Contributor
  2. linked a pull request that will close this issue[2.1] Log index, board and topic views again #9778on Oct 19, 2026
  3. added theissue type on Oct 19, 2026
  4. added this to the 2.1.9 milestone on Oct 19, 2026
  5. Thidox commented on Oct 19, 2026

    @Thidox
    Author

    Apologies it is not different. I wasn't able to find that PR earlier though...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions