Skip to content

CampTix: hide unknown attendees from the public attendees list - #2117

Merged
mcliwanow merged 2 commits into
WordPress:productionfrom
wputasic:fix/2114-hide-unknown-attendees
Sep 24, 2026
Merged

mcliwanow merged 2 commits into
WordPress:productionfrom
wputasic:fix/2114-hide-unknown-attendees

Conversation

@wputasic

@wputasic wputasic commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

What

hide_unconfirmed_attendees() keeps unclaimed tickets off the public [camptix_attendees] list, but it only excludes attendees whose username is the [[ unconfirmed ]] placeholder. The buyer's own row keeps the buyer's real username even when it was marked as an unknown attendee (add_username_to_attendee_object()), so it gets past the filter and shows up as Unknown Attendee.

This PR also excludes the unknown-attendee placeholder email (UNKNOWN_ATTENDEE_EMAIL), the same way prevent_unknown_attendees_viewing_private_content() already identifies these records. It's a query change, so it hides the rows that are already on live sites too, and no data migration is needed.

It also bumps the [camptix_attendees] cache buster. The cache key only hashes the shortcode attributes, so without the bump sites would keep serving the cached list with these rows for up to 3 hours (1 day on archived sites) after deploy.

Fixes #2114. See #1480, #1721.

This PR doesn't change checkout. Making an unknown buyer row get the placeholder username (option 2 in #2114) would only affect new purchases, and it narrows what #1480 widened, so I've left it for a separate follow-up.

Tests

These are the first tests for the Require Login addon. tests/addons/test-require-login.php renders the real shortcode against real attendee posts:

  • a confirmed attendee is listed (a control, so the other tests can't pass vacuously);
  • an attendee with the [[ unconfirmed ]] username is hidden (existing behaviour, now covered);
  • an unknown attendee with a real username is hidden. This test fails without the fix.

To make that possible, the CampTix test bootstrap now enables the addon through camptix_default_addons, the same way camptix-tweaks does on every WordCamp site. Addons have to be registered before camptix_init, so a test can't load it itself. One existing test, test_insert_attendee_drafts_aborts_and_cleans_up_when_a_draft_cannot_be_written, builds checkout attendees by hand, so it now sets username on them, as the addon does during a real checkout. Without that, the addon's camptix_checkout_update_post_meta callback wrote an undefined-property warning to the error log.

Checked locally:

  • Mutation: with the hide_unconfirmed_attendees hook removed, both "hidden" tests fail.
  • Full suite on this branch vs. clean production in the local harness: 1797 vs. 1794 tests (+3 tests, +5 assertions), and the set of failing tests is identical in both runs. Those failures already exist in the local environment, and none are in CampTix. The PHP warnings also match clean production once the fixture above is fixed.
  • CampTix suite: 163 tests, OK (5 skipped, which need intl).
  • .github/bin/phpcs-branch.php against production: clean.

How to test the changes in this Pull Request:

  1. On a WordCamp site (Require Login is active), create a published tix_attendee post with tix_first_name = Unknown, tix_last_name = Attendee, tix_email = unknown.attendee@example.org and tix_username = any real username. That's what checkout stores when the buyer's own row is marked as unknown (see CampTix: "Unknown Attendee" tickets show up on the public attendees page #2114 for how that happens).
  2. Visit the page with [camptix_attendees] (e.g. /attendees/).
  3. Before this PR, "Unknown Attendee" is listed. After it, it isn't, and confirmed attendees still are.
  4. Or run phpunit --filter Test_Camptix_Require_Login_Addon.

`hide_unconfirmed_attendees()` only excluded attendees whose username is the
`[[ unconfirmed ]]` placeholder. The buyer's own row keeps the buyer's real
username even when it was marked as an unknown attendee, so it slipped
through and showed up on `[camptix_attendees]` as "Unknown Attendee".

Also exclude the unknown-attendee placeholder email, which is how
`prevent_unknown_attendees_viewing_private_content()` already identifies
these records. Bump the attendees cache buster so sites stop serving the
cached list with those rows as soon as this is deployed.

Adds the first tests for the Require Login addon, which is now enabled in
the CampTix test bootstrap the same way `camptix-tweaks` enables it on
every WordCamp site.

Fixes WordPress#2114.
With the Require Login addon now loaded in the test bootstrap, its
camptix_checkout_update_post_meta callback reads $attendee->username.
Real checkout attendees always have it, because the addon sets it on
camptix_form_register_complete_attendee_object, but the attendees this
test builds by hand didn't, which wrote an undefined-property warning to
the error log.
@mcliwanow
mcliwanow self-requested a review September 24, 2026 09:42

@mcliwanow mcliwanow left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reproduced it locally with a buyer row marked unknown: it shows on production and it's gone on this branch, and the cache key bump means no flush is needed. Removing the new tix_email clause fails only the new test. Approving.

I will deploy this change soon.

@mcliwanow
mcliwanow merged commit a1a1cec into WordPress:production Sep 24, 2026
5 checks passed
bor0 added a commit that referenced this pull request Oct 8, 2026
* CampTix: store an unknown attendee on the buyer's row as unknown

Follow-up to #2117. On a direct link to the ticket form, the "I don't know
who will use this ticket yet" checkbox also shows on the buyer's own row.
Ticking it there stored a half-unknown ticket: the stub name (only filled
in when the name was empty), the buyer's real pre-filled email, and the
buyer's username. Neither check on the public list catches that, so the
ticket was listed as "Unknown Attendee".

- add_unknown_attendee_info_stubs() always uses the stub name and the
  placeholder email when the box is ticked. The form only hides the
  fields, so it still submits whatever was pre-filled.
- Row 1 gets the [[ unconfirmed ]] username when the box is ticked, so the
  ticket can be claimed like any other unknown ticket. The buyer's
  username is kept in tix_buyer_username, and
  get_abandoned_draft_attendee_ids() checks it too, so the buyer isn't
  held up by their own abandoned drafts.
- A new camptix_checkout_receipt_email filter lets Require Login send the
  receipt to the logged-in buyer when it would go to the placeholder.

See #2114

* CampTix: send the claim link on a one-ticket order for an unknown attendee

Multiple purchases send each unknown attendee's ticket e-mail to the
buyer, with the claim link to forward. A one-ticket order only got the
receipt, which links to the buyer's own order page, so the buyer had no
claim link to pass on.

Adds a camptix_email_single_purchase_attendee_ticket filter after the
single-purchase receipt, and Require Login uses it to send the existing
unknown-attendee e-mail when the order's only ticket is unknown.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Boro Sitnikovski <buritomath@gmail.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.

CampTix: "Unknown Attendee" tickets show up on the public attendees page

2 participants