Skip to content

[3.0] Lists ten topic starters in the statistics centre - #9725

Merged
jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/stats-top-starters-ten
Oct 4, 2026
Merged

jdarwood007 merged 1 commit into
SimpleMachines:release-3.0from
albertlast:3.0/stats-top-starters-ten

Conversation

@albertlast

Copy link
Copy Markdown
Collaborator

Description

The statistics centre's topic starters list counts the twenty members with the most topics, looks their names up, and places each by rank:

$i = array_search($row_members['id_member'], array_keys($members));

// skip all not top 10
if ($i > 10) {
	continue;
}

Two things go wrong with that:

  • $i > 10 keeps ranks 0 to 10, which is eleven. Every other list on the page has ten.
  • A starter with no member to name keeps its place empty. Topics credited to member 0 (guests) or to a deleted member are counted, but the name lookup finds nobody, so that rank is skipped and the list is one shorter than it should be.

The two faults can cancel out: on a forum where one of the top eleven is a guest, the list shows ten. That also means fixing only the > would leave a gap.

It now takes the members that were found, in rank order, and keeps the first ten.

Tests

tests/Integration/Http/StatsStartersTest.php, with members and topics made for the test and removed afterwards:

  • eleven members with two topics each: the list has ten entries. Before the fix it has eleven.
  • the same, plus three topics credited to member 0, ranked first: still ten. With only > changed to >=, this one gets nine.

Both pass on MySQL and PostgreSQL. tests/Integration/Http is not part of the CI run yet.

2.1.7 has the same code. #9722 changes the query that feeds this list, but not these lines.

Issues References (Fixes|Related|Closes)

Related: #9722

🤖 Generated with Claude Code

The top topic starters are counted from the topics table, twenty of them,
and their names looked up afterwards. Each was placed by its rank and those
ranked after index 10 were skipped, which kept eleven. A starter with no
member to name, such as topics credited to a guest or to a deleted member,
kept its place empty, so the two faults could hide each other.

Now the members found are taken in rank order and the first ten kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
@jdarwood007 jdarwood007 added this to the 3.0 Alpha 5 milestone Oct 4, 2026
@jdarwood007
jdarwood007 merged commit dee9a94 into SimpleMachines:release-3.0 Oct 4, 2026
11 checks passed
jdarwood007 pushed a commit that referenced this pull request Oct 17, 2026
$i > 10 kept ranks 0 to 10, which is eleven, and a starter with no member
to name (a guest or a deleted member) left its rank empty. The list now
takes the members found, in rank order, and keeps the first ten.

Backport of #9725.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: albertlast <mathiaspapealbert@hotmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants