From b37c8f906bc3b6ca721f8d3ed9f9313e35c2fa30 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Tue, 10 Jul 2018 09:55:50 -0400 Subject: [PATCH] New management option for removing member profiles from own entity managers Option to simplify the admin area for Own Entity managers when they really only need to edit their contact and not the member profile. --- classes/data/settings/dataSettingsGeneral.php | 7 +++++ index.php | 8 ++--- setup/adminHooks.php | 24 ++++++++------ ...1.1.36.sql => create_database_V1.1.37.sql} | 22 +++++++++++++ setup/databaseScripts/dbVersions.php | 1 + .../update_database_V1.1.37.sql | 31 +++++++++++++++++++ views/admin/management/index.html | 4 +++ 7 files changed, 83 insertions(+), 14 deletions(-) rename setup/databaseScripts/{create_database_V1.1.36.sql => create_database_V1.1.37.sql} (97%) create mode 100644 setup/databaseScripts/update_database_V1.1.37.sql diff --git a/classes/data/settings/dataSettingsGeneral.php b/classes/data/settings/dataSettingsGeneral.php index e2784fa0..cdd679bf 100644 --- a/classes/data/settings/dataSettingsGeneral.php +++ b/classes/data/settings/dataSettingsGeneral.php @@ -172,6 +172,13 @@ class GlmDataSettingsGeneral extends GlmDataAbstract 'use' => 'a' ), + // Enable Caching + 'enable_contact_edit_only' => array( + 'field' => 'enable_contact_edit_only', + 'type' => 'checkbox', + 'use' => 'a' + ), + // Enable File Library Menu 'file_library' => array( 'field' => 'file_library', diff --git a/index.php b/index.php index 1202775e..07988925 100644 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Members Database * Plugin URI: http://www.gaslightmedia.com/ * Description: Gaslight Media Members Database. - * Version: 2.10.34 + * Version: 2.10.35 * Author: Gaslight Media * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -19,7 +19,7 @@ * @package glmMembersDatabase * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 2.10.34 + * @version 2.10.35 */ $GLOBALS['glmAssociateMemTracker'] = memory_get_usage(); @@ -47,8 +47,8 @@ if (!defined('ABSPATH')) { * */ -define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.34'); -define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.36'); +define('GLM_MEMBERS_PLUGIN_VERSION', '2.10.35'); +define('GLM_MEMBERS_PLUGIN_DB_VERSION', '1.1.37'); // 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/adminHooks.php b/setup/adminHooks.php index 7ad18ad3..61e13761 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -167,17 +167,21 @@ add_action('admin_menu', 'glmAdminMenuTests'); // If members are enabled if ( isset( $config ) && isset( $config['settings'] ) && $config['settings']['enable_members'] ) { - // Add member widgets + $lockedToMember = apply_filters('glm_members_locked_to_member_id', false); + $enable_contact_edit_only = $config['settings']['enable_contact_edit_only']; - add_filter( - 'glm-member-db-dashboard-member-widgets', - function ( $member = null ) { - $content = $this->controller( 'dashboard', 'index', $member ); - return $content; - }, - 10, - 1 - ); + // Add member widgets + if ( !$enable_contact_edit_only && !$lockedToMember ) { + add_filter( + 'glm-member-db-dashboard-member-widgets', + function ( $member = null ) { + $content = $this->controller( 'dashboard', 'index', $member ); + return $content; + }, + 10, + 1 + ); + } add_filter( 'glm-member-db-dashboard-member-admin-widgets', function ( $input = '' ) { diff --git a/setup/databaseScripts/create_database_V1.1.36.sql b/setup/databaseScripts/create_database_V1.1.37.sql similarity index 97% rename from setup/databaseScripts/create_database_V1.1.36.sql rename to setup/databaseScripts/create_database_V1.1.37.sql index 548ba666..e54ebbe0 100644 --- a/setup/databaseScripts/create_database_V1.1.36.sql +++ b/setup/databaseScripts/create_database_V1.1.37.sql @@ -325,6 +325,7 @@ CREATE TABLE {prefix}settings_general ( enable_multiple_profiles BOOLEAN DEFAULT '0', enable_member_reports BOOLEAN DEFAULT '1', enable_caching BOOLEAN DEFAULT '1', + enable_contact_edit_only BOOLEAN DEFAULT '0', memb_info_location BOOLEAN DEFAULT '1', memb_info_contact BOOLEAN DEFAULT '1', memb_info_categories BOOLEAN DEFAULT '1', @@ -663,3 +664,24 @@ INSERT INTO {prefix}settings_theme ) ; +---- + +-- Member Email Notifications +CREATE TABLE {perfix}email_notifications ( + id INT NOT NULL AUTO_INCREMENT, + notification_message TEXT NULL, + declined_message TEXT NULL, + approved_message TEXT NULL, + to_email TINYTEXT NULL, + from_email TINYTEXT NULL, + PRIMARY KEY (id) +); + +---- + +-- Set default email notifications +INSERT INTO {prefix}email_notifications + ( id, notification_message, declined_message, approved_message ) +VALUES + ( 1, 'A member has requested a profile update.', 'Your profile update has been declined.', 'Your profile has been approved!' ); + diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 86304cb3..64ed5eb6 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -68,6 +68,7 @@ $glmMembersDbVersions = array( '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.36' => array('version' => '1.1.36', 'tables' => 22, 'date' => '06/12/18'), + '1.1.37' => array('version' => '1.1.37', 'tables' => 23, 'date' => '06/25/18'), ); diff --git a/setup/databaseScripts/update_database_V1.1.37.sql b/setup/databaseScripts/update_database_V1.1.37.sql new file mode 100644 index 00000000..8a8df779 --- /dev/null +++ b/setup/databaseScripts/update_database_V1.1.37.sql @@ -0,0 +1,31 @@ +-- 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 + +-- Member Email Notifications +CREATE TABLE {prefix}email_notifications ( + id INT NOT NULL AUTO_INCREMENT, + notification_message TEXT NULL, + declined_message TEXT NULL, + approved_message TEXT NULL, + to_email TINYTEXT NULL, + from_email TINYTEXT NULL, + PRIMARY KEY (id) +); + +---- + +-- Set default email notifications +INSERT INTO {prefix}email_notifications + ( id, notification_message, declined_message, approved_message ) +VALUES + ( 1, 'A member has requested a profile update.', 'Your profile update has been declined.', 'Your profile has been approved!' ); + +---- + +-- Update Settings General +ALTER TABLE {prefix}settings_general ADD enable_contact_edit_only BOOLEAN DEFAULT '0'; diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 922536ed..01257d23 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -102,6 +102,10 @@ (Only needed until Members are removed from GLM Associate.) + + Enable Contact Edits Only + + Enable Member Reports -- 2.17.1