From: Chuck Scott Date: Thu, 26 Jul 2018 15:38:36 +0000 (-0400) Subject: Various updates related to the Search Add-On and code cleanup. X-Git-Tag: v2.10.37^2~11 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=3ee52d93b8bd46deaf5511946d92da62d04c6126;p=WP-Plugins%2Fglm-member-db.git Various updates related to the Search Add-On and code cleanup. Added code to determine when a member record needs to be re-indexed by the search add-on. Removed depreciated code from glmMembersAdminNotices() - Function to be removed later. Removed some temporary debug code from admin controller. Added glmMembersConfigArraySetup() array to provide easy expansion of config data in glmPluginSupport.php Finished adding requests for search engine to index, re-index, or remove a member from search results. Added a comment to the top of the updateRequiredPages function in admin/management/index.php file. --- diff --git a/controllers/front.php b/controllers/front.php index 71335403..4675a530 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -50,13 +50,7 @@ class glmMembersFront extends GlmPluginSupport // Save plugin configuration object $this->config = $config; - // Check the database - allow installation of tables for a new add-on -/* if (!$this->checkDatabase('install')) { - die('Database check failure'); - } -*/ - - // Now add any shortcodes from the config 'shortcodes' table + // Add any shortcodes from the config 'shortcodes' table while (list($key, $val) = each($this->config['shortcodes'])) { add_shortcode($key, array( @@ -64,7 +58,6 @@ class glmMembersFront extends GlmPluginSupport 'controller' ) ); - } /* @@ -199,7 +192,7 @@ class glmMembersFront extends GlmPluginSupport // Register any front.css files in the css directory of any glm members plugin foreach ($this->config['addOns'] as $a) { $cssFile = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH.$a['slug'].'/css/front.css'; - + if (is_file($cssFile)) { $cssName = $a['slug'].'-front-css'; wp_register_style( @@ -215,7 +208,7 @@ class glmMembersFront extends GlmPluginSupport $cssGridFile = GLM_MEMBERS_PLUGIN_PATH.'/css/glm-grid.css'; if (is_file($cssGridFileOld)) { - + $cssGridNameOld = 'grid-front-css-old'; wp_register_style( $cssGridNameOld, diff --git a/index.php b/index.php index 07988925..26d0d09e 100644 --- a/index.php +++ b/index.php @@ -1,8 +1,8 @@ requiredPages = array(); foreach ( $this->config[ 'addOns' ] as $a ) { if ( isset ( $a[ 'requiredPages' ] ) ) { diff --git a/models/admin/member/index.php b/models/admin/member/index.php index 22780c9d..9fdfbc83 100644 --- a/models/admin/member/index.php +++ b/models/admin/member/index.php @@ -302,8 +302,11 @@ class GlmMembersAdmin_member_index extends GlmDataMembers glmClearShortcodeCache(); - } + // Ask to re-index this member. + $url = GLM_MEMBERS_SITE_BASE_URL.$this->config['settings']['canonical_member_page'].'/'.$memberData['fieldData']['member_slug'].'/'; + $result = apply_filters( 'glm_member_db_common_search_indexurl', $url ); + } } } diff --git a/models/admin/member/memberEdit.php b/models/admin/member/memberEdit.php index e60692f4..b92b8ea4 100644 --- a/models/admin/member/memberEdit.php +++ b/models/admin/member/memberEdit.php @@ -182,7 +182,10 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers } - // $memberStatusBefore = $this->getDisplayStatus($this->memberID); + // Determine member status before operation for check if search engine request needed + require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php'; + $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config); + $memberStatusBefore = $MemberInfo->getActiveInfoIdForMember($this->memberID); /* * Perform requested action @@ -230,20 +233,20 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers glmClearShortcodeCache(); - // Get member display status again and if status goes from true to false, remove it from the search index -/* - $memberStatusAfter = $this->getDisplayStatus($this->memberID); - $url = ''; // ************************* NEED TO PUT URL HERE ************************* + // Get member display status again to see if there is a search engine request neeeded + $memberStatusAfter = $MemberInfo->getActiveInfoIdForMember($this->memberID); + $url = GLM_MEMBERS_SITE_BASE_URL.$this->config['settings']['canonical_member_page'].'/'.$memberData['fieldData']['member_slug'].'/'; + if ($memberStatusBefore && !$memberStatusAfter) { $result = apply_filters( 'glm_member_db_common_search_removeurl', $url ); } if (!$memberStatusBefore && $memberStatusAfter) { $result = apply_filters( 'glm_member_db_common_search_indexurl', $url ); } -*/ + break; - // Add the new member + // Add the new member case 'addNew': $memberData = $this->insertEntry(); diff --git a/models/admin/member/memberInfo.php b/models/admin/member/memberInfo.php index e8e99c38..16e36da6 100644 --- a/models/admin/member/memberInfo.php +++ b/models/admin/member/memberInfo.php @@ -358,7 +358,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo $memberUpdated = true; $memberUpdateError = false; } - + } else { $memberUpdateError = true; } @@ -381,6 +381,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo $this->memberInfoID = $this->memberInfo['fieldData']['id']; $this->haveMemberInfo = true; + $memberUpdated = true; // Update submitted amenities $this->updateAmenities(); @@ -506,6 +507,17 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo } + // Check if the member should be indexed, reindexed or be removed from search results + $nowActive = $this->isActive(); + $url = GLM_MEMBERS_SITE_BASE_URL.$this->config['settings']['canonical_member_page'].'/'.$this->memberInfo['fieldData']['member_slug'].'/'; + if ($nowActive && $memberUpdated) { + $result = apply_filters( 'glm_member_db_common_search_indexurl', $url ); + } + if (!$activeTest && $this->isActive) { + $result = apply_filters( 'glm_member_db_common_search_removeurl', $url ); + } + + // If have member then store the current member ID for later reference if ($this->memberID) { update_option('glmMembersDatabaseMemberID', $this->memberID); diff --git a/package.json b/package.json index d2e80abb..258afc96 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "glm-member-db", "version": "0.0.0", - "description": "=== Gaslight Media Member Database === Contributors: cscott@gaslightmedia.com Donate link: http://www.gaslightmedia.com Tags: Gaslight Media,Plugin,Members Requires at least: 3.0.1 Tested up to: 3.4 Stable tag: 4.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html", + "description": "=== GLM Associate === Contributors: cscott@gaslightmedia.com Donate link: http://www.gaslightmedia.com Tags: Gaslight Media,Plugin,Members Requires at least: 3.0.1 Tested up to: 3.4 Stable tag: 4.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/readme.txt b/readme.txt index cfd0386c..9bf21534 100644 --- a/readme.txt +++ b/readme.txt @@ -1,4 +1,4 @@ -=== Gaslight Media Member Database === +=== GLM Assoicate - Members Plugin === Contributors: cscott@gaslightmedia.com Donate link: http://www.gaslightmedia.com Tags: Gaslight Media,Plugin,Members @@ -18,7 +18,7 @@ and will not activate of that doesn't exist or is not of a recent enough version The current list of these plugins/add-ons is below. There may be additional add-ons not listed here. -* Main Plugin with Members Database +* Core Plugin with Members Database * Contacts Add-On that provides both informational and log-in contacts with a range of capabilities. * Events Add-On that is a full function Events calendar * Packaging Add-On that provide "packaged" offers diff --git a/views/admin/management/index.html b/views/admin/management/index.html index 01257d23..97629458 100644 --- a/views/admin/management/index.html +++ b/views/admin/management/index.html @@ -48,9 +48,6 @@ - These settings now enabling "trigger_error()" output where that's available. This is replacing the legacy - debug output that used a separate debug window. So far only Front Controller has debug tests included. -