Added call to search add-on filter to index packaging page when any package is updated.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Jul 2018 15:45:18 +0000 (11:45 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 26 Jul 2018 15:45:18 +0000 (11:45 -0400)
Also some work for migration of plugin names to GLM Associate

index.php
models/admin/member/packaging.php
readme.txt

index b383dd4..8673187 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,8 +1,8 @@
 <?php
 /**
- * Plugin Name: GLM Members Database Packaging
+ * Plugin Name: GLM Assoicate - Packaging Add-On
  * Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
+ * Description: Gaslight Media GLM Associate Packaging database addd-on.
  * Version: 1.2.19
  * Author: Gaslight Media
  * Author URI: http://www.gaslightmedia.com/
@@ -10,7 +10,7 @@
  */
 
 /**
- * Gaslight Media Members Database Packaging Add-On
+ * Gaslight Media GLM Associate - Packaging Add-On
  * Index
  *
  * PHP version 5.5
index 2eac0dc..9b56d46 100644 (file)
@@ -94,6 +94,7 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
         $memberName     = false;
         $option         = false;
         $error          = false;
+        $indexPackages  = false;
 
         // Load Notifications from the helper classes
         include_once GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH . '/helper/notification.php';
@@ -190,6 +191,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
                     $havePackage = true;
                     $packageUpdated = true;
 
+                    // Flag that a search engine update is needed
+                    $indexPackages = true;
+
                     // Tell the template we're going to be editing.
                     $option = 'edit';
 
@@ -252,6 +256,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
                     // Tell the template the package was updated
                     $packageUpdated = true;
 
+                    // Flag that a search engine update is needed
+                    $indexPackages = true;
+
                     glmClearShortcodeCache();
 
                 // Otherwise it didn't update, tell the template and let them try again
@@ -278,6 +285,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
                     $this->deleteEntry($packageID, true);
                     $packageDeleted = true;
 
+                    // Flag that a search engine update is needed
+                    $indexPackages = true;
+
                     glmClearShortcodeCache();
                 }
 
@@ -333,6 +343,32 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
 
         }
 
+
+
+        // If we need to re-index the packages list page(s)
+        if ($indexPackages) {
+
+            // Get a list of all published pages that have a package list shortcode
+            $prefix = $this->wpdb->get_blog_prefix();
+            $shortcodePages = $this->wpdb->get_results("
+                SELECT ID, post_title, post_name
+                  FROM ".$prefix."posts
+                 WHERE post_status = 'publish'
+                   AND post_content LIKE '%[glm-members-packaging-list%'
+            ", ARRAY_A);
+
+            // If there's any pages with this shortcode
+            if ($shortcodePages != NULL && is_array($shortcodePages) && count($shortcodePages) > 0) {
+                foreach ($shortcodePages as $shortcodePage) {
+
+                    // Build the URL to that page and ask for it to be indexed.
+                    $pageUrl = GLM_MEMBERS_SITE_BASE_URL.$shortcodePage['post_name'].'/';
+                    $result = apply_filters( 'glm_member_db_common_search_indexurl', $pageUrl );
+
+                }
+            }
+        }
+
         // Compile template data
         $templateData = array(
             'havePackages'   => $havePackages,
index b4c528f..52867de 100644 (file)
@@ -1,4 +1,4 @@
-=== Gaslight Media Member Database Packaging Child Plugin ===
+=== GLM Associate - Packaging Add-On ===
 Contributors: cscott@gaslightmedia.com
 Donate link: http://www.gaslightmedia.com
 Tags: Gaslight Media,Plugin,Members Packaging
@@ -8,12 +8,12 @@ Stable tag: 4.3
 License: GPLv2 or later
 License URI: http://www.gnu.org/licenses/gpl-2.0.html
 
-This is the Gaslight Media Members Database Packaging Child Plugin.
+This is the Gaslight Media GLM Associate Packaging Add-On.
 
 == Description ==
 
-The Gaslight Media Members Database Packaging Child Plugin is an add-on to the Gaslight Media Members Database,
-which is required to install and run this plugin
+The Gaslight Media GLM Associate Packaging Add-On is a child plugin to the Gaslight Media GLM Associate Members plugin
+which is required to install and run this plugin.
 
 == Installation ==
 
@@ -26,6 +26,10 @@ e.g.
 
 
 == Changelog ==
+
+= (pending) = 
+* Added filter to update search engine if GLM Associate - OpenSearchServer Add-On is installed and active.
+
 = 1.2.18 =
 * Add management option for member message and for overriding moderated member
   packages.