Function Reference: geodir_event_location_update_count_reviews

Summary

Update the reviews count for upcoming events for current location.

Global Values

$wpdb
(object) (required) WordPress Database object.

Default: None
$plugin_prefix
(string) (required) Geodirectory plugin table prefix.

Default: None

Return Values

(bool)
  • True if update, otherwise false.

Change Log

Since: 1.2.4

Source File

geodir_event_location_update_count_reviews() is located in geodir_event_manager/gdevents_functions.php [Line: 2002]

Source Code

function geodir_event_location_update_count_reviews() {
	global $wpdb, $plugin_prefix;
	
	$listing_table = $plugin_prefix . 'gd_event_detail';
	$today_date = date_i18n( 'Y-m-d', current_time( 'timestamp' ) );
	
	$sql = "SELECT ed.post_id FROM `" . $listing_table . "` AS ed INNER JOIN " . EVENT_SCHEDULE . " AS es ON (es.event_id = ed.post_id) WHERE ed.post_locations !='' AND es.event_enddate = '" . date_i18n( 'Y-m-d', strtotime($today_date . ' -1 day')  ) . "'";
	$rows = $wpdb->get_results($sql);
	if (!empty($rows)) {
		foreach ($rows as $row) {
			$post_id = $row->post_id;
			geodir_term_review_count_update($post_id);
		}
		
		return true;
	}
	
	return false;;
}