From 0f8c7454ce255a627091a6136e54e23f78b00c90 Mon Sep 17 00:00:00 2001 From: Ian Dunn Date: Mon, 25 Sep 2023 09:47:21 -0700 Subject: [PATCH] CampTix: Format SQL queries for readability --- .../wp-content/plugins/camptix/camptix.php | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/public_html/wp-content/plugins/camptix/camptix.php b/public_html/wp-content/plugins/camptix/camptix.php index 800960f00..847b994fc 100644 --- a/public_html/wp-content/plugins/camptix/camptix.php +++ b/public_html/wp-content/plugins/camptix/camptix.php @@ -234,7 +234,17 @@ function send_emails_batch() { $this->log( 'Executing e-mail job.', $email->ID, null, 'notify' ); $max = apply_filters( 'camptix_notify_recipients_batch_count', 200 ); // plugins can change this. - $recipients_data = $wpdb->get_results( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS meta_id, meta_value FROM $wpdb->postmeta WHERE $wpdb->postmeta.post_id = %d AND $wpdb->postmeta.meta_key = %s LIMIT %d;", $email->ID, 'tix_email_recipient_id', $max ) ); + $recipients_data = $wpdb->get_results( $wpdb->prepare( " + SELECT SQL_CALC_FOUND_ROWS meta_id, meta_value + FROM $wpdb->postmeta + WHERE + $wpdb->postmeta.post_id = %d AND + $wpdb->postmeta.meta_key = %s + LIMIT %d;", + $email->ID, + 'tix_email_recipient_id', + $max + ) ); $total = $wpdb->get_var( "SELECT FOUND_ROWS();" ); $processed = 0; @@ -270,7 +280,15 @@ function send_emails_batch() { foreach ( $attendees as $attendee_id ) { $attendee_email = get_post_meta( $attendee_id, 'tix_email', true ); - $count = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_id = %d LIMIT 1;", $email->ID, $recipients[$attendee_id] ) ); + $count = $wpdb->query( $wpdb->prepare( " + DELETE FROM $wpdb->postmeta + WHERE + post_id = %d AND + meta_id = %d + LIMIT 1;", + $email->ID, + $recipients[$attendee_id] + ) ); if ( $count > 0 ) {