From: Steve Sutton Date: Thu, 3 Nov 2016 17:57:27 +0000 (-0400) Subject: Sort the events array if action is featured. X-Git-Tag: v1.5.3^2 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=refs%2Fheads%2Fhotfix%2F1.5.3;p=WP-Plugins%2Fglm-member-db-events.git Sort the events array if action is featured. This is for templates that don't use the events grouped by day. --- diff --git a/index.php b/index.php index 413dff4..fd7903e 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Members Database Events * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.5.2 + * Version: 1.5.3 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -20,7 +20,7 @@ * @package glmMembersDatabaseEventsAddOn * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.5.2 + * @version 1.5.3 */ /* @@ -38,7 +38,7 @@ * 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.5.2'); +define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.5.3'); define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.22'); // This is the minimum version of the GLM Members DB plugin require for this plugin. diff --git a/models/front/events/list.php b/models/front/events/list.php index 00d3c39..f123ab0 100644 --- a/models/front/events/list.php +++ b/models/front/events/list.php @@ -574,6 +574,13 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction } } $eventsByDate = $mainEvents; + } else if ( $events && $action == 'featured' ) { + usort( $events, function( $event1, $event2 ){ + if ( $event1['starting_timestamp'] == $event2['starting_timestamp'] ) { + return 0; + } + return ( $event1['starting_timestamp'] < $event2['starting_timestamp'] ) ? -1: 1; + } ); } // Check for alternate template requests