Skip to content

Commit

Permalink
Adjust messaging for application emails
Browse files Browse the repository at this point in the history
  • Loading branch information
pkevan committed Oct 25, 2024
1 parent 3052e3b commit a4474ad
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,15 @@ public function submit_application( $post_data ) {
$message = $application_data->get_error_message();
$notice_classes = 'notice-error';
} else {
$this->create_post( $application_data );
$application_post = $this->create_post( $application_data );
if ( is_wp_error( $application_post ) ) {
// Set application post to an int, rather than wp_error.
$application_post = 0;
}
$this->notify_applicant_application_received(
$this->get_organizer_email(),
$this->get_event_location()
$this->get_event_location(),
$application_post
);

$this->notify_new_application_in_slack();
Expand Down Expand Up @@ -253,8 +258,9 @@ public function display_notice( $message, $notice_classes ) {
*
* @param string $email_address
* @param string $event_city
* @param int $application_post id of post created on WC Central.
*/
public function notify_applicant_application_received( $email_address, $event_city ) {
public function notify_applicant_application_received( $email_address, $event_city, $application_post ) {
//translators: Name of the event. E.g. WordCamp or meetup.
$subject = sprintf( __( "We've received your %s application", 'wordcamporg' ), $this->get_event_label() );
$headers = array(
Expand All @@ -265,12 +271,21 @@ public function notify_applicant_application_received( $email_address, $event_ci
//translators: 1: Name of the event. 2: City of the event.
$message = sprintf(
__(
"Thank you for applying to organize a %1\$s in %2\$s! We'll send you a follow-up e-mail once we've had a chance to review your application.",
"Thank you for applying to organize a %1\$s in %2\$s! We'll send you a follow-up e-mail once we've had a chance to review your application.\n\n",
'wordcamporg'
),
$this->get_event_label(),
sanitize_text_field( $event_city )
);
$message .= sprintf(
"---- Internal details for the Community Team ----\n\n
Name: %1\$s\n
Type: %2\$s\n
URL: : https://central.wordcamp.org/wp-admin/post.php?post=%3\$d&action=edit",
$this->get_event_label(),
sanitize_text_field( $event_city ),
absint( $application_post ),
);

wp_mail( $email_address, $subject, $message, $headers );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ public function get_default_application_values() {
*
* @param array $data
*
* @return bool|WP_Error
* @return int|WP_Error
*/
public function create_post( $data ) {
// Create the post.
Expand Down Expand Up @@ -201,7 +201,7 @@ public function create_post( $data ) {

$this->post = get_post( $post_id );

return true;
return $post_id;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ public function get_default_application_values() {
*
* @param array $data
*
* @return bool|WP_Error
* @return int|WP_Error
*/
public function create_post( $data ) {
// Create the post.
Expand Down Expand Up @@ -264,7 +264,7 @@ public function create_post( $data ) {

$this->post = get_post( $post_id );

return true;
return $post_id;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static function get_application_report_url() {
*
* @param array $data
*
* @return bool|\WP_Error
* @return int|\WP_Error
*/
public function create_post( $data ) {
// Create the post.
Expand Down Expand Up @@ -259,7 +259,7 @@ public function create_post( $data ) {
);

$this->post = get_post( $post_id );
return true;
return $post_id;
}

/**
Expand Down

0 comments on commit a4474ad

Please sign in to comment.