/** * Static method that is fired within 24 hours after a campaign is finished. * * @param int $campaign_id * @return boolean * @access public * @static * @since 1.1.0 */ public static function send_with_campaign_id($campaign_id) { if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) { return false; } $campaign = new Charitable_Campaign($campaign_id); $time_since_ended = $campaign->get_time_since_ended(); /* If the since since ended is 0 (campaign is still going) or more than 24 hours, return false */ if ($time_since_ended == 0 || $time_since_ended > 86400) { return false; } $email = new Charitable_Email_Campaign_End(array('campaign' => $campaign)); $email->send(); return true; }
/** * Static method that is fired within 24 hours after a campaign is finished. * * @param int $campaign_id * @return boolean * @access public * @static * @since 1.1.0 */ public static function send_with_campaign_id($campaign_id) { if (!charitable_get_helper('emails')->is_enabled_email(self::get_email_id())) { return false; } $email = new Charitable_Email_Campaign_End(array('campaign' => new Charitable_Campaign($campaign_id))); /** * Don't resend the email. */ if ($email->is_sent_already($campaign_id)) { return false; } /** * Check whether the campaign expired in the last 24 hours. */ if (!$email->is_time_to_send()) { return false; } $sent = $email->send(); /** * Log that the email was sent. */ if (apply_filters('charitable_log_email_send', true, self::get_email_id(), $email)) { $email->log($campaign_id, $sent); } return true; }