Making WordPress.org

Changeset 701


Ignore:
Timestamp:
06/12/2014 10:32:24 PM (12 years ago)
Author:
iandunn
Message:

WordCamp Organizer Reminders: Prevent retroactively sending new e-mails to old WordCamps.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-organizer-reminders/wcor-mailer.php

    r700 r701  
    322322     * isn't scheduled until 2 months before the start). When that happens, we want to send all the e-mails that they've missed.
    323323     *
     324     * We don't want newly created messages to be retroactively sent to all WordCamps that occurred before the e-mail was created though, so we
     325     * only send messages to camps that were created after the e-mail was created.
     326     *
    324327     * @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
    325328     * 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.
     
    331334     */
    332335    protected function timed_email_is_ready_to_send( $wordcamp, $email, $sent_email_ids ) {
    333         $ready      = false;
     336        $ready = false;
     337
     338        if ( strtotime( $wordcamp->post_date ) < strtotime( $email->post_date ) ) {
     339            return $ready;
     340        }
     341
    334342        $send_when  = get_post_meta( $email->ID, 'wcor_send_when', true );
    335343        $start_date = get_post_meta( $wordcamp->ID, 'Start Date (YYYY-mm-dd)', true );
     
    339347            $end_date = $start_date;
    340348        }
    341        
     349
    342350        if ( ! in_array( $email->ID, $sent_email_ids ) ) {
    343351            if ( 'wcor_send_before' == $send_when ) {
Note: See TracChangeset for help on using the changeset viewer.