Add private phone contact field to submissions (show_phone) [#288]#289
Merged
Conversation
Register the new private 'phone' post meta (auth-gated like email), persist it on REST submission, include it in copied events and in the submission/publish email notifications. Mirrors the email field's private posture; never added to public output. Crow-Session: 5E1A6449-17EC-46B4-AFB4-04489D7DE710 Co-Authored-By: Claude <noreply@anthropic.com>
New 'show_phone' shortcode attribute (default false) gates the private phone input on the event submission form, mirroring the existing show_flyer visibility pattern. Visibility is independent of required-ness: phone becomes mandatory only when listed in additional_required_fields. Crow-Session: 5E1A6449-17EC-46B4-AFB4-04489D7DE710 Co-Authored-By: Claude <noreply@anthropic.com>
Crow-Session: 5E1A6449-17EC-46B4-AFB4-04489D7DE710 Co-Authored-By: Claude <noreply@anthropic.com>
Mirror the event-form phone work on the announcement submission form and endpoint: store the private phone meta, include it in the notification email, and gate the form input behind the new show_phone shortcode attribute. Crow-Session: 5E1A6449-17EC-46B4-AFB4-04489D7DE710 Co-Authored-By: Claude <noreply@anthropic.com>
- EventsControllerTest: assert phone meta is stored and that submission succeeds when phone is omitted (optional by default). - ShortcodesDocs: document the new show_phone option on both forms. - readme.txt changelog entry; regenerated translation template. Crow-Session: 5E1A6449-17EC-46B4-AFB4-04489D7DE710 Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #288
Investigation finding (the maintainer's ask)
Case (c): the phone field did not exist anywhere.
rg -i 'phone|contact_number|contact_phone|phone_number'acrossincludes/,assets/js/src/,tests/, andtemplates/returned only "megaphone" icon references. The two existing private contact fields wereemailandcontact_name, so this PR addsphoneas a sibling that mirrors the email field's private posture exactly.What changed
A new private phone contact field on both the event and announcement submission forms.
show_phoneshortcode attribute (defaultfalse) gates the field — mirroring the existingshow_flyerprecedent (includes/Frontend.phprender_event_form/render_announcement_form; consumed assettings.showPhone === 'true'inEventForm.js/AnnouncementForm.js). No field was optionally-visible before; this mechanism generalizes to future fields.phoneto the existingadditional_required_fieldsattribute (same path asflyer). It is not added todefaultRequiredFields.emailstays the hard-required field (it drives notifications) and is untouched.register_post_meta('mayo_event', 'phone', …)with the sameauth_callback => current_user_can('edit_posts')gate asemail(includes/Admin.php), persisted inEventsController::submit_event()(add_post_meta(..., 'phone', sanitize_text_field($params['phone'] ?? ''))) and in the announcement controller. Shown to admins in the event editor's existing "Contact Information (Private)" sidebar panel (EventBlockEditorSidebar.js) and included in the submission/publish notification emails."Not displayed publicly" — verified
Phone is never added to
EventsController::format_event()(the public event formatter) or to any public template /EventDetails.js— the same exclusion that keepsemail/contact_nameprivate today. The only places it surfaces are the auth-gated admin sidebar and the notification emails to organizers. Theauth_callbackon the registered meta keeps it out of unauthenticated REST.Required enforcement note
There is no per-field server-side hard rejection for any field in this plugin (none exists for
emaileither) — required-ness is enforced client-side via themissingFieldscheck plus the conditional HTMLrequiredattribute, and the REST endpoint cannot know a given form instance's shortcode config. Phone follows that same model: it's markedrequiredin the form when configured, and the endpoint sanitizes-and-stores. This was an explicit product decision by the maintainer (phone as an optional/configurable required field; keepemailas the locked one).Tests
composer test→ OK (528 tests, 1185 assertions). NewEventsControllerTestcases assert the phone meta is stored when provided and that submission still succeeds when phone is omitted (optional-by-default).npm run buildcompiles cleanly.Scope
Covers both the event and announcement submission forms (both are "submissions" sharing the identical private-contact pattern). Shortcode docs (
ShortcodesDocs.js), thereadme.txtchangelog, and the translation POT were updated.🤖 Generated with Claude Code