Skip to content

Commit

Permalink
Reports: Prepare post type in query
Browse files Browse the repository at this point in the history
  • Loading branch information
iandunn committed Oct 18, 2023
1 parent 4b7d3f5 commit 059cfc3
Showing 1 changed file with 9 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,25 +216,22 @@ public function get_data() {
}

/**
* Get all Meetup posts which have status changed between given time fram
* Get all Meetup posts which have status changed between given time frame.
*
* @return array
*/
protected function get_meetup_posts() {
global $wpdb;
$meetup_post_type = WCPT_MEETUP_SLUG;
$meetup_post_objs = $wpdb->get_results(
$wpdb->prepare(
"
SELECT DISTINCT post_id
FROM {$wpdb->prefix}postmeta
WHERE
meta_key LIKE '_status_change_log_$meetup_post_type%'
AND
meta_value >= %d
AND
meta_value <= %d
",
$wpdb->prepare( "
SELECT DISTINCT post_id
FROM {$wpdb->prefix}postmeta
WHERE
meta_key LIKE %s AND
meta_value >= %d AND
meta_value <= %d",
sprintf( '_status_change_log_%s%%', $meetup_post_type ),
$this->range->start->getTimestamp(),
$this->range->end->getTimestamp()
)
Expand Down

0 comments on commit 059cfc3

Please sign in to comment.