From d66bfb4409633f4bdafac88d266ff669af34c49a Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Fri, 1 Jun 2018 12:15:08 -0400 Subject: [PATCH] Apply the limit to events after the sorting. After the resorting of the events need to check for and apply any limit. --- index.php | 6 +++--- models/front/events/list.php | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/index.php b/index.php index 8a10a78..a5acf84 100644 --- a/index.php +++ b/index.php @@ -4,7 +4,7 @@ * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 1.6.84 + * Version: 1.6.85 * Author: Chuck Scott * Author URI: http://www.gaslightmedia.com/ @@ -22,7 +22,7 @@ * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.6.84 + * @version 1.6.85 */ @@ -47,7 +47,7 @@ if (!defined('ABSPATH')) { * 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.84'); +define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.6.85'); define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.5'); // 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 fd7cea2..704079d 100644 --- a/models/front/events/list.php +++ b/models/front/events/list.php @@ -791,6 +791,9 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction } return ( $event1['starting_timestamp'] < $event2['starting_timestamp'] ) ? -1: 1; } ); + if ( $limit && $limit = filter_var( $limit, FILTER_VALIDATE_INT ) ) { + $events = array_slice( $events, 0, $limit ); + } } // Check for alternate template requests -- 2.17.1