Skip to content

Fix 7354 readable active user threshold - #9910

Open
boredskull wants to merge 2 commits into
SimpleMachines:release-3.0from
boredskull:fix-7354-readable-active-user-threshold
Open

boredskull wants to merge 2 commits into
SimpleMachines:release-3.0from
boredskull:fix-7354-readable-active-user-threshold

Conversation

@boredskull

Copy link
Copy Markdown

[3.0] Display active-user threshold in hours, days or weeks

Summary

This pull request addresses issue #7354 by improving how the user online time threshold is displayed on the forum's board index.

Currently, SMF displays the configured threshold in minutes regardless of its duration. This can result in unnecessarily large values, such as:

Users active in the past 1440 minutes

The proposed enhancement automatically converts the threshold into hours, days or weeks where appropriate, making the information easier for members to read.

Changes Made

1. Human-readable time thresholds

The board index now uses the largest appropriate time unit when the configured threshold can be converted exactly.

Examples:

Configured Threshold New Display
60 minutes 1 hour
90 minutes 90 minutes
120 minutes 2 hours
1,440 minutes 1 day
2,880 minutes 2 days
10,080 minutes 1 week
20,160 minutes 2 weeks

Thresholds that cannot be converted into whole hours, days or weeks continue to display in minutes, preserving accuracy.

2. Language and pluralisation support

Added three new language strings:

  • users_active_hours
  • users_active_days
  • users_active_weeks

These use SMF's existing ICU pluralisation format to support singular and plural wording.

The original users_active language string remains unchanged for backward compatibility.

3. Minimal changes to existing functionality

The enhancement affects only how the online threshold is displayed.

It does not change how SMF tracks online users, calculates activity periods or stores the configured threshold.

Files Modified

  • Themes/default/BoardIndex.template.php
  • Languages/en_US/General.php

No database changes, additional dependencies or changes to the underlying online tracking system are required.

Testing

Completed:

  • Verified the conversion logic against 12 different threshold values.
  • Confirmed correct handling of whole hours, days and weeks.
  • Confirmed that non-exact conversions remain in minutes.
  • Verified the new language strings include singular and plural forms.
  • Confirmed that only the two intended files were modified.

All 12 conversion checks passed.

Further testing recommended:

  • Verify the displayed text on a running SMF 3.0 installation.
  • Confirm correct formatting with translated language packs.
  • Check compatibility with custom themes.
  • Run the full PHP test suite.

Browser-based integration testing has not yet been completed.

Expected Result

The board index should display the configured online activity threshold using a more natural time unit wherever possible.

For example:

Before:

Users active in the past 1440 minutes

After:

Users active in the past 1 day

This improves readability without changing the behaviour of the existing online user tracking system.

Issues References (Fixes|Related|Closes)

Related #7354

@github-actions github-actions Bot added Theme Boards Localization Language & internationalization labels Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Boards Localization Language & internationalization Theme

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant