Various updates related to the Search Add-On and code cleanup.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Jul 2018 15:38:36 +0000 (11:38 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Jul 2018 15:38:36 +0000 (11:38 -0400)
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.

controllers/front.php
index.php
models/admin/management/index.php
models/admin/member/index.php
models/admin/member/memberEdit.php
models/admin/member/memberInfo.php
package.json
readme.txt
views/admin/management/index.html

index 7133540..4675a53 100644 (file)
@@ -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,
index 0798892..26d0d09 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,8 +1,8 @@
 <?php
 /**
- * Plugin Name: GLM Members Database
+ * Plugin Name: GLM Associate - Members Plugin
  * Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
+ * Description: Gaslight Media GLM Associate core plugin and Members database.
  * Version: 2.10.35
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
@@ -10,7 +10,7 @@
  */
 
 /**
- * Gaslight Media Members Database
+ * GLM Associate - Members Plugin
  * Index
  *
  * PHP version 5.5
index 022bf29..ff9e020 100644 (file)
@@ -61,7 +61,11 @@ class GlmMembersAdmin_management_index extends GlmDataSettingsGeneral
         parent::__construct( false, false );
 
     }
-     public function updateRequiredPages(){
+
+    /*
+     * SOMEONE NEEDS TO DOCUMENT THIS FUNCTION
+     */
+    public function updateRequiredPages(){
         $this->requiredPages = array();
         foreach ( $this->config[ 'addOns' ] as $a ) {
             if ( isset ( $a[ 'requiredPages' ] ) ) {
index 22780c9..9fdfbc8 100644 (file)
@@ -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 );
 
+                }
 
             }
         }
index e60692f..b92b8ea 100644 (file)
@@ -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();
index e8e99c3..16e36da 100644 (file)
@@ -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);
index d2e80ab..258afc9 100644 (file)
@@ -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"
index cfd0386..9bf2153 100644 (file)
@@ -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
index 01257d2..9762945 100644 (file)
@@ -48,9 +48,6 @@
                 </td>
             </tr>
         </table>
-        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.
-        <p>&nbsp;</p>
 
         <!-- Required Pages -->