Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -972,7 +972,7 @@ public function handle_cc_needs_orientation( WP_Post $post ) {
array(
'timestamp' => time(),
'user_id' => get_current_user_id(),
'message' => __( 'Application moved to Needs Orientation. Organizer notification email triggered.', 'wordcamporg' ),
'message' => __( 'Application moved to Needs Orientation. Organizer notification email trigger fired.', 'wordcamporg' ),
)
);

Expand Down Expand Up @@ -1340,7 +1340,7 @@ public function get_admin_notices() {

5 => array(
'type' => 'updated',
'notice' => __( 'This Campus Connect application has been moved to Needs Orientation. The organizer notification email has been triggered and a note has been added to the log.', 'wordcamporg' ),
'notice' => __( 'This Campus Connect application has been moved to Needs Orientation and a note has been added to the log. The organizer notification email is sent by the Automated Reminder assigned to the "Campus Connect application needs orientation" trigger — if no reminder is assigned, no email goes out.', 'wordcamporg' ),
),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,13 @@ protected function send_triggered_emails( $wordcamp, $trigger ) {
$emails = $this->get_triggered_posts( $trigger );
$is_repeatable = ! empty( $this->triggers[ $trigger ]['repeatable'] );

if ( ! $emails ) {
log( 'Trigger fired, but no reminder posts are assigned to it.', compact( 'trigger', 'wordcamp' ) );
return;
}

$sent = 0;

foreach( $emails as $email ) {
if ( ! $this->applies_to_wordcamp( $wordcamp, $email ) ) {
continue;
Expand All @@ -1015,8 +1022,13 @@ protected function send_triggered_emails( $wordcamp, $trigger ) {

if ( $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ) ) {
$sent_email_ids[] = $email->ID;
$sent++;
update_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', $sent_email_ids );
}
}

if ( ! $sent ) {
log( 'Trigger fired, but every assigned reminder was skipped or failed.', compact( 'trigger', 'wordcamp' ) );
}
}
}
Loading