Skip to content

Show the date listings are sorted by in the default listings layout - #172

Merged
sorinmarta merged 3 commits into
masterfrom
fix-3118
Oct 29, 2026
Merged

sorinmarta merged 3 commits into
masterfrom
fix-3118

Conversation

@sorinmarta

Copy link
Copy Markdown
Contributor

Fixes Strategy11/awpcp#3118
Adds a $most_recent_start_date placeholder and uses it in the default listings layout (including saved copies of the unchanged old default), so renewed listings show the renewal date that places them in the date sort.

@sorinmarta sorinmarta added run analysis Run the phpcs run tests Run the unit tests franky-review labels Oct 29, 2026
@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 56 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: a4d94eb4-1804-4081-a91c-d637db866ca5
Commits

Reviewing files that changed from the base of the PR and between 4f83b1a and 860ccfd.

Files selected for processing: 5
  • frontend/ad-functions.php
  • frontend/placeholders.php
  • includes/helpers/class-listing-renderer.php
  • includes/settings/class-display-settings.php
  • tests/suite/frontend/test-placeholders.php
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Both functions have been no-ops since PHP 8.0 and are deprecated in
PHP 8.5, which fails the PHPCS inspection.
@franky-the-going-merry franky-the-going-merry Bot added the franky-working Franky is actively reviewing this label Oct 29, 2026

@franky-the-going-merry franky-the-going-merry Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approve. The default listings layout now shows the date the date-based sort orders use, and renewed listings show their renewal date.

What I ran (WordPress Playground, base 357533e vs this PR at 80e31d3): two listings, "Renewed" (start 2026-01-10, renewed and _awpcp_most_recent_start_date 2026-09-20) and "Plain" (start and most-recent 2026-03-05). I rendered both through awpcp_render_listings_items() with six saved-layout cases and read the dates out of the output.

Layout case Base, Renewed listing PR, Renewed listing
unset (default) 2026-01-10 2026-09-20
saved copy of the old default 2026-01-10 2026-09-20
saved old default with CRLF and extra blank lines 2026-01-10 2026-09-20
saved old default plus a custom edit 2026-01-10 2026-01-10 (custom layout kept)
custom layout using $awpcpadpostdate 2026-01-10 2026-01-10 (unchanged)
custom layout using $most_recent_start_date placeholder not replaced 2026-09-20

The Plain listing shows 2026-03-05 in every case, so listings that were never renewed look the same as before. CI is green (PHPUnit 7.4/8, PHPStan, PHPCS).

Not covered: I did not render the real Browse Listings page, so there is no screenshot of the final markup. The in-process render shows the date text, not the page styling. I also did not run the PHPUnit suite locally; CI did.

Non-blocking notes

  • A saved layout that someone edited at all (even one character) keeps $awpcpadpostdate, so those sites keep showing the original date. That matches the PR description. A line in the changelog or the setting's help text would save a support question.
  • awpcp_get_listings_layout() has no unit test. The whitespace-insensitive match against the previous default is the only non-obvious logic in the PR.
  • The finfo_close() / imagedestroy() to unset() change in class-mime-types.php and deprecated.php is unrelated to the ticket (the same change is in #171). Fine to keep, but it would read better as its own commit or PR.

@sorinmarta
sorinmarta merged commit b6a1d80 into master Oct 29, 2026
5 checks passed
@sorinmarta
sorinmarta deleted the fix-3118 branch October 29, 2026 11:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run analysis Run the phpcs run tests Run the unit tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant