Changeset 2898 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php
- Timestamp:
- 04/05/2016 04:05:02 PM (8 years ago)
- Location:
- sites/trunk/wordcamp.org
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org
-
Property
svn:mergeinfo
set to
/sites/branches/application-tracking/wordcamp.org merged eligible
-
Property
svn:mergeinfo
set to
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php
r2156 r2898 7 7 class WCOR_Mailer { 8 8 public $triggers; 9 9 10 10 /** 11 11 * Constructor … … 61 61 ), 62 62 ); 63 63 64 64 add_action( 'wcor_send_timed_emails', array( $this, 'send_timed_emails' ) ); 65 65 66 66 foreach ( $this->triggers as $trigger_id => $trigger ) { 67 67 foreach( $trigger['actions'] as $action ) { … … 72 72 73 73 /** 74 * Schedule cron job when plugin is activated 74 * Schedule cron job when plugin is activated 75 75 */ 76 76 public function activate() { … … 83 83 } 84 84 } 85 85 86 86 /** 87 87 * Clear cron job when plugin is deactivated … … 94 94 * Wrapper for wp_mail() that customizes the subject, body and headers 95 95 * 96 * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but 96 * We want to make sure that replies go to support@wordcamp.org, rather than the fake address that WordPress sends from, but 97 97 * we don't want to be flagged as spam for forging the From header, so we set the Sender header. 98 98 * @see http://stackoverflow.com/q/4728393/450127 … … 213 213 '[safety_wrangler_name]', 214 214 '[safety_wrangler_email]', 215 215 216 216 // Venue 217 217 '[venue_name]', … … 287 287 $this->get_mes_info( $wordcamp->ID ), 288 288 ); 289 289 290 290 return str_replace( $search, $replace, $content ); 291 291 } … … 454 454 return $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ); 455 455 } 456 456 457 457 /** 458 458 * Send e-mails that are scheduled to go out at a specific time (e.g., 3 days before the camp) … … 462 462 'posts_per_page' => -1, 463 463 'post_type' => 'wordcamp', 464 'post_status' => WordCamp_Loader::get_public_post_statuses(), 464 465 'meta_query' => array( 465 466 array( … … 474 475 'posts_per_page' => -1, 475 476 'post_type' => WCPT_POST_TYPE_ID, 476 'post_status' => 'pending',477 'post_status' => WordCamp_Loader::get_pre_planning_post_statuses(), 477 478 ) ); 478 479 … … 490 491 ), 491 492 ) ); 492 493 493 494 foreach ( $wordcamps as $wordcamp ) { 494 495 $sent_email_ids = (array) get_post_meta( $wordcamp->ID, 'wcor_sent_email_ids', true ); … … 496 497 foreach ( $reminder_emails as $email ) { 497 498 $recipient = $this->get_recipients( $wordcamp->ID, $email->ID ); 498 499 499 500 if ( $this->timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) ) { 500 501 if ( $this->mail( $recipient, $email->post_title, $email->post_content, array(), $email, $wordcamp ) ) { … … 520 521 * @todo It'd be nice to have some unit tests for this function, since there are a lot of different cases, but it seems like that might be 521 522 * hard to do because of having to mock get_post_meta(), current_time(), etc. We could pass that info in, but that doesn't seem very elegant. 522 * 523 * 523 524 * @param WP_Post $wordcamp 524 525 * @param WP_Post $email … … 544 545 if ( 'wcor_send_before' == $send_when ) { 545 546 $days_before = absint( get_post_meta( $email->ID, 'wcor_send_days_before', true ) ); 546 547 547 548 if ( $start_date && $days_before ) { 548 549 $send_date = $start_date - ( $days_before * DAY_IN_SECONDS ); 549 550 550 551 if ( $send_date <= current_time( 'timestamp' ) ) { 551 552 $ready = true; … … 557 558 if ( $end_date && $days_after ) { 558 559 $send_date = $end_date + ( $days_after * DAY_IN_SECONDS ); 559 560 560 561 if ( $send_date <= current_time( 'timestamp' ) ) { 561 562 $ready = true; … … 575 576 } 576 577 } 577 578 578 579 return $ready; 579 580 }
Note: See TracChangeset
for help on using the changeset viewer.