* Plugin Name: GLM Members Database Events
* Plugin URI: http://www.gaslightmedia.com/
* Description: Gaslight Media Members Database.
- * Version: 1.6.15
+ * Version: 1.6.16
* Author: Chuck Scott
* Author URI: http://www.gaslightmedia.com/
* License: GPL2
* @package glmMembersDatabaseEventsAddOn
* @author Chuck Scott <cscott@gaslightmedia.com>
* @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.6.15
+ * @version 1.6.16
*/
/*
* so that we're sure the other add-ons see an up to date
* version from this plugin.
*/
-define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.15');
+define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.16');
define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.1');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events AS ET
WHERE ET.status = " . $this->config['status_numb']['Active'] . "
)
+ AND $this->dateRangeTimes
";
$events = $this->getList( $where );
{
global $wpdb;
-
+
$event_data = [];
-
+
// this section is for a sidebar events widget, typically on a front page
if( isset( $_REQUEST['date_string'] ) || isset($_REQUEST['all_events'] ) ){
$image_url = GLM_MEMBERS_PLUGIN_MEDIA_URL . '/images/small/';
-
+
if(isset($_REQUEST['date_string'])){
$date = date_parse($_REQUEST['date_string']);
$month = $date['month'];
$year = $date['year'];
-
+
$sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX ."events WHERE status = 10 AND id IN (SELECT event FROM ";
$sql .= GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE YEAR(start_time) = $year AND MONTH(start_time) = $month AND active = 1 AND end_time >= CURDATE() ORDER BY start_time) LIMIT 3; ";
$events = $wpdb->get_results($sql);
-
+
} else if(isset($_REQUEST['all_events'])){
-
+
// $sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX ."events WHERE status = 10 AND id IN (SELECT event FROM ";
// $sql .= GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times ORDER BY start_time) LIMIT 3";
$sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times WHERE end_time >= CURDATE() GROUP BY event ORDER BY start_time LIMIT 3;";
// $sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times ORDER BY start_time LIMIT 3;";
$events_times = $wpdb->get_results($sql);
-
+
foreach($events_times as $times){
$sql = "SELECT * FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events WHERE id = " . $times->event.";";
$event[] = $wpdb->get_results($sql);
foreach($ev as $e){
$events[] = $e;
}
-
+
}
}
foreach($events as $event){
} else {
$end_date = '';
}
-
+
$start_date = date('M d', strtotime($date[0]->start_time));
$start_timestamp = strtotime($start_date);
$end_timestamp = strtotime($end_date);
-
+
if($start_timestamp < $end_timestamp){
$start_date = $start_date . " - " . $end_date;
}
- $sidebar_events[$event->id] =
+ $sidebar_events[$event->id] =
array(
"start_date" => $start_date,
- "end_date" => $end_date,
- "name" => $event->name,
- "content" => $event->intro,
+ "end_date" => $end_date,
+ "name" => $event->name,
+ "content" => $event->intro,
'image' => $image,
'id' => $event->id,
'timestamp' => $start_timestamp,
}
}
}
-
+
ksort($arrayDates);
}
// end section for front page events widget data
-
+
$month = filter_var_array(
$_REQUEST['month'],
array(
$from = date('Y-m-d', strtotime($start));
$to = date('Y-m-d', strtotime($last));
- $this->dateRange = "start_time BETWEEN CAST('{$from}' AS DATE) AND CAST('{$to}' as DATE)";
+ $this->dateRangeTimes = "start_time BETWEEN CAST('{$from}' AS DATE) AND CAST('{$to}' as DATE)";
$this->dateRange = "id IN (
SELECT id
FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times
// $slug = sanitize_title( $val['event_name'] );
$event_data[$e]['url'] = GLM_MEMBERS_EVENTS_SITE_BASE_URL . "event-detail/" . $slug . "/";
}
-
+
$return = array(
// 'status' => false, // Assume nothing works
'events' => $event_data , // Where our events list will go