Campus Connect: admin notice and audit log on Approved For Pre-Planning (issue #1714 point 5)#1731
Campus Connect: admin notice and audit log on Approved For Pre-Planning (issue #1714 point 5)#1731dorsvenabili wants to merge 4 commits into
Conversation
#1714 point 4) When a Campus Connect post transitions to wcpt-approved-pre-pl, fire a new dedicated WordPress action wcpt_cc_approved_for_pre_planning. A separate action is used (rather than reusing wcpt_approved_for_pre_planning) to avoid triggering the non-CC hooks that listen on that action (add_organizer_to_central, mark_date_added_to_planning_schedule), which are not appropriate for CC posts. The wcor-mailer registers a matching trigger wcor_cc_approved_for_pre_planning and callback so that an Automated Reminder post can be created in the admin to send the approval email to the organizer (+ [email protected] via the "organizing team" recipient) when this transition occurs. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
…issue #1714 point 5) When wcpt_cc_approved_for_pre_planning fires (i.e. a Campus Connect post transitions to wcpt-approved-pre-pl), a new handler does two things: 1. Writes a permanent _note meta entry to the post log with a timestamp and the message "Application approved for pre-planning. Organizer notification email queued." — visible in the private notes log on the post edit screen. 2. Queues admin notice key 5, which the existing active_admin_notices / add_admin_notices_to_redirect_url / print_admin_notices pipeline displays as a green success banner on the next page load after the save redirect. Depends on point 4 (PR #1730) for the wcpt_cc_approved_for_pre_planning action. Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
There was a problem hiding this comment.
Pull request overview
Implements the “Approved For Pre-Planning” follow-up for Campus Connect applications by surfacing immediate admin feedback to wranglers and recording a permanent entry in the application’s private log. The PR also wires a new Organizer Reminders trigger for the dedicated Campus Connect approval action.
Changes:
- Add a
wcpt_cc_approved_for_pre_planninghandler that appends a_notelog entry and queues a one-time admin notice after saving. - Add a new admin notice (key
5) confirming CC pre-planning approval + queued email + log entry. - Register a new Organizer Reminders trigger (
wcor_cc_approved_for_pre_planning) mapped to thewcpt_cc_approved_for_pre_planningaction.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php |
Adds a new trigger definition and callback for the CC approval action. |
public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-admin.php |
Fires a CC-specific approval action; logs a private note and queues an admin notice when that action runs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // Audit log note — same text as the admin notice, stored permanently with a timestamp. | ||
| add_post_meta( | ||
| $post->ID, | ||
| '_note', | ||
| array( |
| 'wcor_cc_approved_for_pre_planning' => array( | ||
| 'name' => 'Campus Connect application approved for pre-planning', | ||
| 'actions' => array( | ||
| array( | ||
| 'name' => 'wcpt_cc_approved_for_pre_planning', |
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
| } elseif ( 'wcpt-approved-pre-pl' === $new_status | ||
| && 'campusconnect' === get_post_meta( $post->ID, 'event_subtype', true ) ) { | ||
| // Fires when a Campus Connect application is approved for pre-planning. | ||
| // Uses a dedicated action to avoid triggering the non-CC hooks that listen | ||
| // to wcpt_approved_for_pre_planning (e.g. add_organizer_to_central). | ||
| do_action( 'wcpt_cc_approved_for_pre_planning', $post ); |
| // Queue the one-time admin notice that will display after the save redirect. | ||
| $this->active_admin_notices[] = 5; | ||
| } |
| array( | ||
| 'timestamp' => time(), | ||
| 'user_id' => get_current_user_id(), | ||
| 'message' => __( 'Application approved for pre-planning. Organizer notification email queued.', 'wordcamporg' ), |
| * @param WP_Post $post The Campus Connect post that was approved. | ||
| */ | ||
| public function handle_cc_approved_for_pre_planning( WP_Post $post ) { | ||
| // Audit log note — same text as the admin notice, stored permanently with a timestamp. |
| 'wcor_cc_approved_for_pre_planning' => array( | ||
| 'name' => 'Campus Connect application approved for pre-planning', | ||
| 'actions' => array( | ||
| array( | ||
| 'name' => 'wcpt_cc_approved_for_pre_planning', | ||
| 'callback' => 'send_trigger_cc_approved_for_pre_planning', | ||
| 'priority' => 10, | ||
| 'parameters' => 1, | ||
| ), | ||
| ), | ||
| ), |
There was a problem hiding this comment.
🤖 AI-assisted review — generated with Claude Code and overseen by a maintainer. Please treat it as advisory and verify anything before acting on it.
Update: the merge-conflict resolution is the maintainers' to handle, not yours — annotated below.
Hi @dorsvenabili 👋 — reviewed as part of the #1714 set. What I did: fetched the branch, linted the changed PHP (clean on PHP 8.4), traced the action wiring, and test-merged against production and against #1730.
The mechanics are fine — it writes a _note, queues notice key 5 through the existing active_admin_notices → add_admin_notices_to_redirect_url → print_admin_notices pipeline, and using add_post_meta() directly (instead of #1729's wcpt_add_private_note() helper) to avoid a cross-PR dependency is a reasonable call.
Items
[blocking] The stated dependency on #1730 is incorrect, and the two conflict.ℹ️ Conflict resolution is on the maintainers (handled at merge) — no action needed from you. Two things for the record: (a) this PR already contains its owndo_action( 'wcpt_cc_approved_for_pre_planning', $post ), so it does not depend on #1730 for that action — the dependency note in the description is just out of date; (b) #1730 and #1731 conflict inwordcamp-admin.phpandwcor-mailer.php(confirmed viagit merge-tree), and the maintainers will keep both branches when merging.- [semantic — needs a decision] The notice/note wording. This PR's banner and the permanent audit-log note fire on
wcpt-approved-pre-pland say "An organizer notification email has been queued." But #1730 moved the email trigger to Needs Orientation — so at the Approved-For-Pre-Planning transition, no email is queued. Once the team confirms which status sends the email (see #1730), the wording here needs to match. The maintainers will align this alongside the merge reconciliation.
Merge order
Needs #1728 underneath it (CC detection + reaching wcpt-approved-pre-pl). Does not actually need #1729. Reconciled with #1730 by maintainers at merge.
Per the Copilot review on this PR: - The audit note and admin notice claimed the organizer email was "queued", but the reminders system sends synchronously (or not at all, if no reminder post is configured for the trigger). Reword to "triggered", which is accurate regardless of configuration or outcome. - Fix the inline comment that claimed the note used the "same text as the admin notice"; the two strings are intentionally similar, not identical. Note: there is no "wcor_cc_approved_for_pre_pl" docblock typo — the trigger ID is spelled out in full (wcor_cc_approved_for_pre_planning) throughout. The email-vs-status wording is left for the #1730/#1731 merge reconciliation (issue #1714 points 4/5), pending the decision on which status sends the email. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
|
@dd32 thanks for the review! I confirm that the banner should show up when the status changes to Needs Orientation, right after the organizer email is sent. Please let me know if you need me to update anything in this PR or if this info is enough. |
Summary
Implements point 5 of #1714: when a Campus Connect application is approved for pre-planning, show a temporary success notice to the wrangler and write a permanent audit log entry.
Changes
wcpt-wordcamp/wordcamp-admin.phponly (31 lines)Constructor: registers
handle_cc_approved_for_pre_planning()on thewcpt_cc_approved_for_pre_planningaction.New method
handle_cc_approved_for_pre_planning( WP_Post $post ):_notepost meta entry — same format used by the manual "Add Private Note" metabox — with:timestamp: current Unix time (auto-rendered as a readable date in the log UI)user_id: current usermessage: "Application approved for pre-planning. Organizer notification email queued."5to$this->active_admin_notices, which the existingadd_admin_notices_to_redirect_url/print_admin_noticespipeline picks up and displays after the save redirect.get_admin_notices(): adds entry for key5— a green (updated) banner reading: "This Campus Connect application has been approved for pre-planning. An organizer notification email has been queued and a note has been added to the log."The notice is shown once (after the redirect that follows saving). The log note is permanent.
Test plan
wcpt-approved-pre-pl. After the save redirect, confirm a green success banner appears at the top of the post edit screen.wcpt-approved-pre-pl. Confirm no notice and no note are added.Generated with Claude Code