From 7f72066cc6529b4086394790d8960fc5c93cda51 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 12 Jun 2018 13:04:31 -0400 Subject: [PATCH] DB updates for new management options. Option for turning off member reports. Option for turning on off caching. db updates (management) enable_member_reports enable_caching updates_notification updates_notification_to updates_notification_from db_updates (member_info) has_no_map_data has_no_profile --- classes/data/settings/dataSettingsGeneral.php | 14 +++++++ index.php | 4 +- ...1.1.35.sql => create_database_V1.1.36.sql} | 15 ++++++-- setup/databaseScripts/dbVersions.php | 3 +- ..._V1.1.35.sql => drop_database_V1.1.36.sql} | 2 +- .../update_database_V1.1.36.sql | 37 +++++++++++++++++++ setup/shortcodes.php | 9 ++++- views/admin/management/index.html | 16 ++++++-- views/admin/member/index.html | 4 +- 9 files changed, 90 insertions(+), 14 deletions(-) rename setup/databaseScripts/{create_database_V1.1.35.sql => create_database_V1.1.36.sql} (96%) rename setup/databaseScripts/{drop_database_V1.1.35.sql => drop_database_V1.1.36.sql} (96%) create mode 100644 setup/databaseScripts/update_database_V1.1.36.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index e8211ebf..e2784fa0 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -158,6 +158,20 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'use' => 'a' ), + // Enable Member Reports + 'enable_member_reports' => array( + 'field' => 'enable_member_reports', + 'type' => 'checkbox', + 'use' => 'a' + ), + + // Enable Caching + 'enable_caching' => array( + 'field' => 'enable_caching', + 'type' => 'checkbox', + 'use' => 'a' + ), + // Enable File Library Menu 'file_library' => array( 'field' => 'file_library', diff --git a/index.php b/index.php index 77f23fef..0348e7b7 100644 --- a/index.php +++ b/index.php @@ -19,7 +19,7 @@ * @package glmMembersDatabase * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 2.10.31 + * @version 2.10.30 */ $GLOBALS['glmAssociateMemTracker'] = memory_get_usage(); @@ -47,7 +47,7 @@ if (!defined('ABSPATH')) { */ define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.31'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.35'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.36'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_PLUGIN_VERSION != get_option('glmMembersDatabasePluginVersion')) { diff --git a/setup/databaseScripts/create_database_V1.1.35.sql b/setup/databaseScripts/create_database_V1.1.36.sql similarity index 96% rename from setup/databaseScripts/create_database_V1.1.35.sql rename to setup/databaseScripts/create_database_V1.1.36.sql index d42a32ef..548ba666 100644 --- a/setup/databaseScripts/create_database_V1.1.35.sql +++ b/setup/databaseScripts/create_database_V1.1.36.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/29/16 12:06:00 --- Database Version: 1.1.35 +-- Database Version: 1.1.36 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -193,6 +193,8 @@ CREATE TABLE {prefix}member_info ( member_name TINYTEXT NULL, -- Copy of member name from members table entry for fast reference status INT NULL, -- Status of this member information record - See plugin.ini status table reference_name TINYTEXT NULL, -- Reference name for this member information record - Not displayed on front-end + has_no_map_data BOOLEAN DEFAULT '0', -- True if member info record has no map data + has_no_profile BOOLEAN DEFAULT '0', -- True if member has no profile record descr TEXT NULL, -- Description short_descr TEXT NULL, -- Short description addr1 TINYTEXT NULL, -- Main member location address line 1 @@ -321,6 +323,8 @@ CREATE TABLE {prefix}settings_general ( default_state TINYTEXT DEFAULT NULL, enable_counties BOOLEAN DEFAULT '0', enable_multiple_profiles BOOLEAN DEFAULT '0', + enable_member_reports BOOLEAN DEFAULT '1', + enable_caching BOOLEAN DEFAULT '1', memb_info_location BOOLEAN DEFAULT '1', memb_info_contact BOOLEAN DEFAULT '1', memb_info_categories BOOLEAN DEFAULT '1', @@ -431,6 +435,9 @@ CREATE TABLE {prefix}settings_general ( detail_map_show_amenities BOOLEAN DEFAULT '0', members_only_support_email TINYTEXT DEFAULT '', members_only_support_phone TINYTEXT DEFAULT '', + updates_notification_to TINYTEXT DEFAULT '', -- To email address for the notification email + updates_notification_from TINYTEXT DEFAULT '', -- From header for the notification email + updates_notification TEXT DEFAULT '', -- Notification message short_desc_char_limit INTEGER DEFAULT '120', -- How many characters the short description is limited to - also used for importing use_cluster_markers BOOLEAN DEFAULT '0', -- Flag to say if cluster markers should be use in maps recaptcha_site_key TINYTEXT DEFAULT '', -- reCAPTCHA site key @@ -444,9 +451,11 @@ CREATE TABLE {prefix}settings_general ( -- Set default entry INSERT INTO {prefix}settings_general - ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size, list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles) + ( id, time_zone, canonical_member_page, list_logo_size, list_map_logo_size, detail_logo_size, detail_map_logo_size, + list_pagination, list_pagination_count, enable_counties, enable_multiple_profiles, enable_member_reports, enable_caching, updates_notification) VALUES - ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20, 0, 0 ) + ( 1, 'America/Detroit', 'member-detail', 'large', 'thumb', 'large', 'thumb', '1', 20, 0, 0, 1, 1, + 'A member has updated their record and is now in a pending state.') ; ---- diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 2a1592ef..86304cb3 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -66,7 +66,8 @@ $glmMembersDbVersions = array( '1.1.32' => array('version' => '1.1.32', 'tables' => 20, 'date' => '06/14/17'), '1.1.33' => array('version' => '1.1.33', 'tables' => 22, 'date' => '01/15/18'), '1.1.34' => array('version' => '1.1.34', 'tables' => 22, 'date' => '01/23/18'), - '1.1.35' => array('version' => '1.1.35', 'tables' => 22, 'date' => '04/03/18') + '1.1.35' => array('version' => '1.1.35', 'tables' => 22, 'date' => '04/03/18'), + '1.1.36' => array('version' => '1.1.36', 'tables' => 22, 'date' => '06/12/18'), ); diff --git a/setup/databaseScripts/drop_database_V1.1.35.sql b/setup/databaseScripts/drop_database_V1.1.36.sql similarity index 96% rename from setup/databaseScripts/drop_database_V1.1.35.sql rename to setup/databaseScripts/drop_database_V1.1.36.sql index 4a0297db..e190e070 100644 --- a/setup/databaseScripts/drop_database_V1.1.35.sql +++ b/setup/databaseScripts/drop_database_V1.1.36.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/09/14 15:27:15 --- Database Version: 1.1.35 +-- Database Version: 1.1.36 -- Database Deletion Script -- Note: Tables with DELETE CASCADE must appear before referenced table diff --git a/setup/databaseScripts/update_database_V1.1.36.sql b/setup/databaseScripts/update_database_V1.1.36.sql new file mode 100644 index 00000000..3b0ef35e --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.36.sql @@ -0,0 +1,37 @@ +-- Gaslight Media Members Database +-- File Created: 2018-06-12 +-- Database Version: 1.1.36 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashses + +ALTER TABLE {prefix}member_info ADD has_no_map_data BOOLEAN DEFAULT '0'; + +---- + +ALTER TABLE {prefix}member_info ADD has_no_profile BOOLEAN DEFAULT '0'; + +---- + +ALTER TABLE {prefix}settings_general ADD enable_member_reports BOOLEAN DEFAULT '1'; + +---- + +ALTER TABLE {prefix}settings_general ADD enable_caching BOOLEAN DEFAULT '1'; + +---- + +ALTER TABLE {prefix}settings_general ADD updates_notification_to TINYTEXT NULL; + +---- + +ALTER TABLE {prefix}settings_general ADD updates_notification_from TINYTEXT NULL; + +---- + +ALTER TABLE {prefix}settings_general ADD updates_notification TEXT NULL; + +---- + +UPDATE {prefix}settings_general SET updates_notification = 'A member has updated their record and is now in a pending state.', enable_member_reports = 1, enable_caching = 1; diff --git a/setup/shortcodes.php b/setup/shortcodes.php index ade4b6ae..a40b54ef 100644 --- a/setup/shortcodes.php +++ b/setup/shortcodes.php @@ -67,6 +67,9 @@ */ //$config = $GLOBALS['config']; if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { + + $enableCache = $config['settings']['enable_caching']; + $glmMembersShortcodes = array( 'glm-members-list' => array( 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, @@ -74,7 +77,7 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { 'action' => 'list', 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', 'cacheControl' => array( - 'active' => false, + 'active' => $enableCache, 'cacheTime' => '2 WEEK' // MySQL "DATE_ADD" time interval - see https://www.w3schools.com/sql/func_date_add.asp ), 'attributes' => array( @@ -143,6 +146,10 @@ if ( isset( $config['settings'] ) && $config['settings']['enable_members'] ) { 'plugin' => GLM_MEMBERS_PLUGIN_SLUG, 'menu' => 'members', 'action' => 'detail', + 'cacheControl' => array( + 'active' => $enableCache, + 'cacheTime' => '2 WEEK' // MySQL "DATE_ADD" time interval - see https://www.w3schools.com/sql/func_date_add.asp + ), 'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general', 'attributes' => array( 'id' => false, diff --git a/views/admin/management/index.html b/views/admin/management/index.html index e7ac627b..922536ed 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -6,7 +6,7 @@