<?php /* Template Name: Process Emails */ $remind = 0; $summary = 0; if (isset($_GET['remind'])) { $remind = $_GET['remind']; } if (isset($_GET['summary'])) { $summary = $_GET['summary']; } if ($remind == 1) { processFlattererReminder(intval(get_field('first_reminder_days', 'option'))); // 5 processFlattererReminder(intval(get_field('second_reminder_days', 'option'))); // 2 } if ($summary == 1) { processFlaterboxCreateSummary(); }
</h1> </div> <div class="box"> <div class="box-padding"> <?php if ($_POST['approved'] == 1) { echo '<h2>Reminders Sent</h2>'; the_content(); // Special Instructions __update_post_meta($PID, 'special_instructions_to_flatterers', $value = $_POST['special-instructions']); // Reminder if (false) { // Hiding, but keeping incase we want to add it back in 7/14/2015 __update_post_meta($PID, 'reminder_instructions', $value = $_POST['additional-reminder']); } processFlattererReminder(0, $PID, $_POST['flatterers'], false); // Change to true to re-enable reminder portion (also in includes/emailFunctions.php) $hideSubmit = true; } else { ?> <h2>Reminder to Send</h2> <div id="flattererfield-single"> <?php $flatterer_results = $wpdb->get_results("SELECT * FROM flatterers WHERE flatterer_email <> '' AND PID = " . $PID, ARRAY_A); $rowCount = $wpdb->num_rows; $nCount = 0; $hideSubmit = false; ?> <?php if ($flatterer_results) { echo '<div class="chk-reminder"><input type="checkbox" id="selectall" value="" checked="checked"> Select / Deselect All</div><div class="clearing"></div>';
<?php /* Template Name: Process Emails */ $remind = 0; $summary = 0; if (isset($_GET['remind'])) { $remind = $_GET['remind']; } if (isset($_GET['summary'])) { $summary = $_GET['summary']; } if ($remind == 1) { processFlattererReminder(); } if ($summary == 1) { processFlaterboxCreateSummary(); } function processFlattererReminder() { global $wpdb; global $post; $DaysBefore = 3; $dyear = date('Y', strtotime('+ ' . $DaysBefore . ' Days ')); $month = date('n', strtotime('+ ' . $DaysBefore . ' Days ')); $list_day = date('j', strtotime('+ ' . $DaysBefore . ' Days ')); $subject = 'Reminder: You\'re invited to send a Flatterbox sentiment!'; $toArr[] = array(); $args = array('post_type' => 'flatterboxes', 'posts_per_page' => -1, 'meta_query' => array(array('key' => 'date_sentiments_complete', 'value' => array($dyear . '-' . $month . '-' . $list_day . ' 00:00:00', $dyear . '-' . $month . '-' . $list_day . ' 23:59:59'), 'compare' => 'BETWEEN', 'type' => 'date'))); $the_query = new WP_Query($args); if ($the_query->have_posts()) { while ($the_query->have_posts()) {