| @@ -229,41 +229,8 @@ | ||
| 229 | 229 | foreach ( $emails_to_send as $email_to_send ) |
| 230 | 230 | { |
| 231 | 231 | $email_id = $email_to_send->email_id; |
| 232 | 232 | |
| 233 | - $contact_id = (int)$email_to_send->contact_id; | |
| 234 | - | |
| 235 | - // Ensure client is still publised, hasn't unsubscribed from emails and that send matching properties is yes | |
| 236 | - // To combat being added to the queue but then the queue only getting processed at a later date | |
| 237 | - $forbidden_contact_methods = get_post_meta( $contact_id, '_forbidden_contact_methods', true ); | |
| 238 | - | |
| 239 | - $email_forbidden = is_array( $forbidden_contact_methods ) && in_array( 'email', $forbidden_contact_methods, true ); | |
| 240 | - | |
| 241 | - $applicant_profile = get_post_meta( $contact_id, '_applicant_profile_' . (int)$email_to_send->applicant_profile_id, true ); | |
| 242 | - | |
| 243 | - $matching_enabled = is_array( $applicant_profile ) | |
| 244 | - && isset( $applicant_profile['send_matching_properties'] ) | |
| 245 | - && 'yes' === $applicant_profile['send_matching_properties']; | |
| 246 | - | |
| 247 | - if ( | |
| 248 | - 'publish' !== get_post_status( $contact_id ) | |
| 249 | - || $email_forbidden | |
| 250 | - || !$matching_enabled | |
| 251 | - ) { | |
| 252 | - $wpdb->update( | |
| 253 | - $wpdb->prefix . 'ph_email_log', | |
| 254 | - array( | |
| 255 | - 'status' => 'fail2', | |
| 256 | - 'lock_id' => '', | |
| 257 | - ), | |
| 258 | - array( 'email_id' => (int)$email_id ), | |
| 259 | - array( '%s', '%s' ), | |
| 260 | - array( '%d' ) | |
| 261 | - ); | |
| 262 | - | |
| 263 | - continue; | |
| 264 | - } | |
| 265 | - | |
| 266 | 233 | $headers = array(); |
| 267 | 234 | $headers[] = 'From: ' . html_entity_decode($email_to_send->from_name) . ' <' . $email_to_send->from_email_address . '>'; |
| 268 | 235 | if ( $email_to_send->cc_email_address != '' ) |
| 269 | 236 | { |
| @@ -452,9 +419,8 @@ | ||
| 452 | 419 | |
| 453 | 420 | // Get all contacts that have a type of applicant |
| 454 | 421 | $args = array( |
| 455 | 422 | 'post_type' => 'contact', |
| 456 | - 'post_status' => 'publish', | |
| 457 | 423 | 'nopaging' => true, |
| 458 | 424 | // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- Matching mail must include all eligible applicant profiles; membership and opt-in eligibility are stored in contact metadata. |
| 459 | 425 | 'meta_query' => $meta_query, |
| 460 | 426 | 'fields' => 'ids' |