Skip to content

Require Actual Attendees field for closing WordCamps#1605

Open
Copilot wants to merge 15 commits intoproductionfrom
copilot/require-actual-attendees-field
Open

Require Actual Attendees field for closing WordCamps#1605
Copilot wants to merge 15 commits intoproductionfrom
copilot/require-actual-attendees-field

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

WordCamps can now only transition to wcpt-closed status when the "Actual Attendees" field is populated. This ensures critical attendance data is collected before events are archived.

Implementation

  • Validation method: Consolidated into require_complete_meta_to_publish_wordcamp() which now handles all status validations

    • Prevents status change to wcpt-closed when required fields are empty
    • Preserves original status and triggers admin notice on validation failure
    • No End Date validation required
  • Code structure: Refactored to reduce duplication

    • Extracted common validation logic into validate_required_fields_for_status() helper method
    • Created specialized validate_closed_status() for closed status validation
    • Single filter hook at priority 11 handles all status validations (needs-site, scheduled, closed)
  • Required fields: Extended get_required_fields() with 'closed' case

    $closed = array(
        'Actual Attendees',
    );
  • Error messaging: Admin notice Merge blocks repo into WordCamp #5 displays specific validation errors

    • Uses transients (60s TTL) to pass error details across redirect
    • Lists missing required fields by name
  • UI improvements for Actual Attendees field:

    • Field is now always visible on the edit screen (not hidden until event closes)
    • Field is readonly/disabled before the event End Date has passed
    • Field is marked as required when editable (after event concludes)
    • Shows CampTix ticket sales information inline (attended and sold counts)
    • Displays contextual message: "This field cannot be set until after the event concludes" when readonly
    • Automatically becomes editable once the event concludes

Compatibility

  • Already-closed events can be edited without re-validation
  • Automated cron closures unaffected (auto-populates Actual Attendees from CampTix)
  • Follows existing validation pattern from require_complete_meta_to_publish_wordcamp()
  • Reduced code duplication by ~50 lines while maintaining all functionality

Screenshots

(Manual testing requires Docker environment setup - screenshots to be added during review)

How to test the changes in this Pull Request:

  1. Edit a WordCamp with status wcpt-scheduled (End Date can be in the past or future)
  2. Observe that "Actual Attendees" field is now visible with CampTix stats displayed
  3. If End Date hasn't passed, verify field is readonly/disabled with message "This field cannot be set until after the event concludes"
  4. If End Date has passed, verify field is editable and shows "(required)" label
  5. Leave "Actual Attendees" field empty and change status to wcpt-closed, then save
  6. Verify status does not change and error notice appears: "This WordCamp cannot be closed. The following required fields must be filled in: Actual Attendees."
  7. Fill in "Actual Attendees" field with a number (e.g., 150) and save
  8. Verify status successfully changes to wcpt-closed
Original prompt

This section details on the original issue you should resolve

<issue_title>Event Trackers: Adjust Actual Attendee field to be required</issue_title>
<issue_description>### Description

The Actual Attendee count is critical for data collection. We would like this field to be required to close to event tracker so that folks input this information.</issue_description>

<agent_instructions>Please ensure that WordCamp post types can't move from various statuses to closed without a set of metadata fields having a value. To start with, it should require the Actual Attendees field to be filled in, but we may want to add other data points.
Please add a descriptive message that highlights the missing fields instead of changing the post status.
This message should appear on the post edit screen.
Additionally, it should not be possible to move an event to Closed before any listed End Date.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@dd32 Are there any other fields we should add that prevents marking an event as finished?

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 6 commits February 13, 2026 02:19
…nd Date check

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
…9:59, remove unnecessary rtrim

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Copilot AI changed the title [WIP] Adjust Actual Attendee field to be required for event trackers Require Actual Attendees field and End Date validation for closing WordCamps Feb 13, 2026
Copilot AI requested a review from dd32 February 13, 2026 02:32
Copy link
Member

Choose a reason for hiding this comment

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

@copilot Can this be merged with require_complete_meta_to_publish_wordcamp at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I've refactored the code to consolidate the validation logic. The require_complete_meta_to_close_wordcamp() method has been merged into require_complete_meta_to_publish_wordcamp(), which now handles all three status transitions (needs-site, scheduled, and closed).

Changes in commit a8c0372:

  • Extracted shared validation logic into validate_required_fields_for_status() helper method
  • Created specialized validate_closed_status() method for closed status with End Date validation
  • All validation now runs through a single filter hook at priority 11
  • Reduces code duplication while maintaining all existing functionality

@dd32
Copy link
Member

dd32 commented Feb 13, 2026

@copilot I believe the Actual attendees feld is currently hidden until the event is closed, can you add the field, but make it disabled before the event concludes?
It would be good to show the Camptix Ticket sales in that area too, like we do on the post type screen.

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
…il event ends, add CampTix stats

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot I believe the Actual attendees feld is currently hidden until the event is closed, can you add the field, but make it disabled before the event concludes?
It would be good to show the Cam...

Done in commit 54525af:

  1. Actual Attendees field is now visible before the event closes (removed the code that was hiding it)
  2. Field is readonly/disabled until the event End Date has passed (added to protected fields dynamically based on end date)
  3. CampTix ticket sales displayed inline with the field description showing both attended and sold counts (e.g., "CampTix: 150 attended, 200 sold")

The field automatically becomes editable once the event concludes (after 23:59:59 on the End Date). If no End Date is set, the Start Date is used as fallback.

@dd32 dd32 marked this pull request as ready for review February 13, 2026 07:55
@dd32
Copy link
Member

dd32 commented Feb 13, 2026

@copilot We can remove the 'End Date checks' we no longer need to validate the end-date has passed.

The 'Actual Attendees' field should also be marked as required when editable.
The 'Actual Attendees' field should note that it can't be set until after the event concludes when readonly.

…itable, update field messages

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot We can remove the 'End Date checks' we no longer need to validate the end-date has passed.

The 'Actual Attendees' field should also be marked as required when editable.
...

Done in commit 961c6e8:

  1. Removed End Date validation: Eliminated all End Date checks from validate_closed_status() and get_close_validation_notice() - events can now be closed regardless of End Date
  2. Actual Attendees marked as required when editable: Field shows "(required)" label when not protected/readonly
  3. Updated field messages:
    • When readonly (before event concludes): "This field cannot be set until after the event concludes. CampTix: X attended, Y sold."
    • When editable (after event concludes): "Number of attendees who actually attended the event. CampTix: X attended, Y sold." with (required) label

The field is dynamically marked as required based on its protection status, and the message clearly indicates when it can be edited.

Co-authored-by: dd32 <767313+dd32@users.noreply.github.com>
Copilot AI changed the title Require Actual Attendees field and End Date validation for closing WordCamps Require Actual Attendees field for closing WordCamps Feb 13, 2026
dd32 and others added 3 commits February 13, 2026 21:47
Tests the new validate_closed_status logic including:
- Closing blocked when Actual Attendees is missing
- Closing allowed when Actual Attendees is provided
- Already-closed WordCamps can be resaved without re-validation
- Actual Attendees field protected before event end date
- Actual Attendees field editable after event end date
- Start date used as fallback when no end date set
- Missing fields stored in transient for error display

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Create posts with draft status and update via $wpdb to avoid
triggering WordCamp-specific hooks (Slack notifications) that fail
without full environment setup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove double empty line in meta keys definition
- Remove trailing whitespace on blank lines
- Add full-stop punctuation to inline comments
- Add phpcs:ignore for global $post override in tests

Co-Authored-By: Claude Opus 4.6 <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.

Event Trackers: Adjust Actual Attendee field to be required

2 participants

Comments