Skip to content

Add an ACP option to show announcements first - #213

Merged
avandenberghe merged 1 commit into
develop33from
issue-201-announcements-first
Oct 4, 2026
Merged

avandenberghe merged 1 commit into
develop33from
issue-201-announcements-first

Conversation

@avandenberghe

Copy link
Copy Markdown
Member

Closes #201.

What it does

  • New setting: a "Show announcements first" ACP setting (rt_announcements_first), off by default, placed next to "Minimum topic type level".
  • When it's on: the announcements and global announcements on the current page of Recent Topics move to the top of that page, newest first. The rest of the page, including stickies, keeps its order.
  • Only the current page moves. Old announcements never come back into the list, the topic count and paging don't change, and an announcement on page 2 leads page 2.
  • Where it applies: the same everywhere the list renders, because it happens in fill_template(): index, forum view, side column, the standalone pages, and unread-only mode.

Changes

  • core/recenttopics.php: a new announcements_first() helper does a stable partition of the page's rows. It runs right after get_topics_sql() and before the modify_topics_list event, so other extensions see the final order. There's no SQL change.
  • migrations/v300/release_3_0_12.php: adds rt_announcements_first = 0 and removes it on revert.
  • acp/recenttopics_module.php, adm/style/acp_recenttopics.html: the checkbox is saved and displayed.
  • RT_ANNOUNCEMENTS_FIRST / _EXP in all 14 language packs, translated using phpBB's own term for "announcement" in each language.

Tests

  • New tests/core/announcements_first_test.php: one page of normal, announcement, sticky and global topics. With the setting on they render announcement, global, normal, sticky; with it off, in the original order. The "on" case failed before the change.
  • New functional tests (CI only):
    • with the setting on, an announcement is listed above a newer normal topic;
    • the ACP checkbox saves the setting.
  • tests/tests.md updated. Unit suite: 73 tests, 0 failures locally, with the harness loading functions_content.php like CI.

Checked on the local board (page 1 as admin, setting changed in memory only; G = global announcement, S = sticky, N = normal):

setting on, current develop33:  N4537 N4156 G3543 N4680 … N4569 G1854 S4064 N4665 …
setting on, this PR:            G3543 G1854 N4537 N4156 N4680 … N4569 S4064 N4665 …
setting off, this PR:           N4537 N4156 G3543 N4680 … N4569 G1854 S4064 N4665 …   (unchanged)

No changelog entry or version bump, per this repo's convention. The migration is named for 3.0.12, the release this ships in.

🤖 Generated with Claude Code

New setting "Show announcements first" (rt_announcements_first, off by
default). When on, fill_template() moves the announcements and global
announcements on the current page to the top of that page, keeping
their time order; the rest of the page, including stickies, keeps its
order. Only rows already on the page move, so old announcements never
come back into the list, and paging is unchanged.

- release_3_0_12 migration adds the config value
- ACP checkbox next to "Minimum topic type level"
- Language strings in all 14 packs

Closes #201

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@avandenberghe
avandenberghe merged commit 731b368 into develop33 Oct 4, 2026
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: pin Announcements / Global Announcements to the top of Recent Topics

1 participant