From: Steve Sutton Date: Tue, 7 Aug 2018 17:05:25 +0000 (-0400) Subject: Update filter to one for active X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=fd31eb63f84fc4582bd450bb7257e120555f6982;p=WP-Plugins%2Fglm-member-db-contacts.git Update filter to one for active Active will get all active memberships. Based on the setting for when to expire past renewal date --- diff --git a/models/admin/ajax/contactsListExport.php b/models/admin/ajax/contactsListExport.php index fe1f90c..d87e15f 100644 --- a/models/admin/ajax/contactsListExport.php +++ b/models/admin/ajax/contactsListExport.php @@ -141,14 +141,19 @@ class GlmMembersAdmin_ajax_contactsListExport extends GlmDataContacts ) "; } - } - - - // echo '
$BFSelect: ' . print_r( $BFSelect, true ) . '
'; - // echo '
$BFHeaders: ' . print_r( $BFHeaders, true ) . '
'; - // exit; + // Check if there is an active only filter + if ( isset( $_REQUEST['active_only'] ) && $active_only = filter_var( $_REQUEST['active_only'], FILTER_VALIDATE_BOOLEAN ) ) { + $days_after_expired = $this->config['settings']['days_after_expired']; + $current_date = date( 'Y-m-d' ); + $where .= " AND T.ref_dest IN ( + SELECT DISTINCT(ref_dest) + FROM " . GLM_MEMBERS_BILLING_PLUGIN_DB_PREFIX . "accounts + WHERE renewal_date IS NOT NULL + AND renewal_date + INTERVAL 1 YEAR + INTERVAL $days_after_expired DAY > '$current_date' + ) "; + } - // Only return information records that are active + } // Check if there is a member_type filter if ( isset( $_REQUEST['filterMemberTypes'] ) && $memberTypeFilter = filter_var( $_REQUEST['filterMemberTypes'], FILTER_VALIDATE_INT ) ) { diff --git a/views/admin/contacts/index.html b/views/admin/contacts/index.html index f4b0940..589b6a2 100644 --- a/views/admin/contacts/index.html +++ b/views/admin/contacts/index.html @@ -121,9 +121,9 @@ {if apply_filters( 'glm-members-billing-enabled', false )} - Only Billing Accounts: + Billing Accounts: -
+ Active Only ( Not Expired )
{/if}