From 2ca75c5f66901852f08db96774a760ec855907ea Mon Sep 17 00:00:00 2001 From: Ryan Marks Date: Wed, 1 Jun 2022 18:27:21 +0100 Subject: [PATCH 1/2] Add allergy default text and email template textarea --- .../camptix-tweaks/addons/allergy.php | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php b/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php index 286429837..0ed103b75 100644 --- a/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php +++ b/public_html/wp-content/mu-plugins/camptix-tweaks/addons/allergy.php @@ -62,6 +62,11 @@ public function camptix_init() { add_filter( 'camptix_privacy_export_attendee_prop', array( $this, 'export_attendee_prop' ), 10, 4 ); add_filter( 'camptix_privacy_attendee_props_to_erase', array( $this, 'attendee_props_to_erase' ) ); add_action( 'camptix_privacy_erase_attendee_prop', array( $this, 'erase_attendee_prop' ), 10, 3 ); + + // E-mail template + add_filter( 'camptix_custom_email_templates', array( $this, 'register_custom_email_templates' ) ); + add_filter( 'camptix_default_options', array( $this, 'custom_email_template_default_values' ) ); + } /** @@ -519,6 +524,35 @@ public function erase_attendee_prop( $key, $type, $post ) { update_post_meta( $post->ID, $key, $anonymized_value ); } } + + /** + * Add an e-mail template for life-threatening allergies. + * + * @param array $templates + * + * @return array + */ + public function register_custom_email_templates( $templates ) { + $templates['email_template_life_threatening_allergy'] = array( + 'title' => __( 'Life-threatening Allergy', 'wordcamporg' ), + 'callback_method' => 'field_textarea', + ); + + return $templates; + } + + /** + * Add the default e-mail template text for life-threatening allergies. + * + * @param array $options + * + * @return array + */ + public function custom_email_template_default_values( $options ) { + $options['email_template_life_threatening_allergy'] = __( "Hey there!\n\nWhen you registered your ticket, you answered 'Yes' to the question 'Do you have a life-threatening allergy that would affect your experience at WordCamp?' If you made the choice by mistake, you can edit the ticket information from:\n\n[ticket_url]\n\nIf you do have a life-threatening allergy, would you be able to provide additional detail and anything related that we should be informed of by replying to this email?", 'wordcamporg' ); + + return $options; + } } camptix_register_addon( __NAMESPACE__ . '\Allergy_Field' ); From d824f97873f93fcb5580e8c8fe1c934d9f8be066 Mon Sep 17 00:00:00 2001 From: Ryan Marks Date: Wed, 1 Jun 2022 18:33:08 +0100 Subject: [PATCH 2/2] Add accomodation default text and email template textarea --- .../camptix-tweaks/addons/accommodations.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/public_html/wp-content/mu-plugins/camptix-tweaks/addons/accommodations.php b/public_html/wp-content/mu-plugins/camptix-tweaks/addons/accommodations.php index 7252a0a00..b6fdf5227 100644 --- a/public_html/wp-content/mu-plugins/camptix-tweaks/addons/accommodations.php +++ b/public_html/wp-content/mu-plugins/camptix-tweaks/addons/accommodations.php @@ -64,6 +64,10 @@ public function camptix_init() { add_filter( 'camptix_privacy_export_attendee_prop', array( $this, 'export_attendee_prop' ), 10, 4 ); add_filter( 'camptix_privacy_attendee_props_to_erase', array( $this, 'attendee_props_to_erase' ) ); add_action( 'camptix_privacy_erase_attendee_prop', array( $this, 'erase_attendee_prop' ), 10, 3 ); + + // E-mail template + add_filter( 'camptix_custom_email_templates', array( $this, 'register_custom_email_templates' ) ); + add_filter( 'camptix_default_options', array( $this, 'custom_email_template_default_values' ) ); } /** @@ -521,6 +525,35 @@ public function erase_attendee_prop( $key, $type, $post ) { update_post_meta( $post->ID, $key, $anonymized_value ); } } + + /** + * Add an e-mail template for accessibility accommodations. + * + * @param array $templates + * + * @return array + */ + public function register_custom_email_templates( $templates ) { + $templates['email_template_accessibility_accommodations'] = array( + 'title' => __( 'Accessibility Accommodations', 'wordcamporg' ), + 'callback_method' => 'field_textarea', + ); + + return $templates; + } + + /** + * Add the default e-mail template text for accessibility accommodations. + * + * @param array $options + * + * @return array + */ + public function custom_email_template_default_values( $options ) { + $options['email_template_accessibility_accommodations'] = __( "Hey there!\n\nWhen you registered your ticket, you answered 'Yes' to the question 'Do you have any accessibility needs, such as a sign language interpreter or wheelchair access, to participate in WordCamp?' If you made the choice by mistake, you can edit the ticket information from:\n\n[ticket_url]\n\nIf you do require an accessibility accommodation, would you be able to provide additional detail and anything related that we should be informed of by replying to this email?", 'wordcamporg' ); + + return $options; + } } camptix_register_addon( __NAMESPACE__ . '\Accommodations_Field' );