Skip to content

Commit

Permalink
Add allergy default text and email template textarea
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Marks committed Jun 2, 2022
1 parent 182f7b0 commit 2ca75c5
Showing 1 changed file with 34 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );

}

/**
Expand Down Expand Up @@ -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' );

0 comments on commit 2ca75c5

Please sign in to comment.