Placed that function in all models that add, delete, or update member data.
return $filteredNumber;
}
+
/**
* glmIsMemberModerated
*
return false;
}
}
+
+/**
+ * glmClearShortcodeCache
+ *
+ * Clears all shortcode caching. Used by admin updates to force front-end output to be up-to-date.
+ * See caching code in front controller.
+ *
+ * @access public
+ * @return void
+ */
+function glmClearShortcodeCache()
+{
+
+ global $wpdb;
+
+ // Remove all cache entries from the database
+ $sql = "DELETE from ".GLM_MEMBERS_PLUGIN_DB_PREFIX."cache;";
+ $wpdb->query($sql);
+
+ return;
+}
// Enqueue all css here so that only happens when we're doing something
$this->glmMembersFrontCSS();
+ /*
+ * Shortcode Caching
+ *
+ * This feature saves all output from a shortcode into a single entry in the cache table.
+ *
+ * Caching is enabled/disabled on a shortcode by shortcode basis by setting the cacheControl array
+ * parameters in the shortcode definition array in "setup/shortcdes.php" for the related add-on.
+ *
+ * The glmClearShortcodeCache() function is used to clear all shortcode caching. This should normally
+ * be used when add, update, delete actions occur on information that could be cached.
+ */
+
// If cache control not active, this must be the top-level page content request
if (!$GLOBALS['cache_control']['active']) {
;";
$this->wpdb->query($sql);
+ glmClearShortcodeCache();
+
}
$haveMember = true;
+ glmClearShortcodeCache();
+
break;
// Add the new member
case 'addNew':
- $memberData = $this->insertEntry();
+ $memberData = $this->insertEntry();
- // If update was successful then use editEntry() to setup for the edit again.
- if ($memberData['status']) {
+ // If update was successful then use editEntry() to setup for the edit again.
+ if ($memberData['status']) {
- $this->memberID = $memberData['fieldData']['id'];
+ $this->memberID = $memberData['fieldData']['id'];
- $slug = $this->updateSlug($this->memberID);
+ $slug = $this->updateSlug($this->memberID);
- $memberData = $this->editEntry($this->memberID);
- $memberUpdated = true;
- $haveMember = true;
+ $memberData = $this->editEntry($this->memberID);
+ $memberUpdated = true;
+ $haveMember = true;
- // Also update all member info records with any possible name change
- $sql = "
- UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
- SET member_name = '".addslashes($memberData['fieldData']['name'])."'
- WHERE member = $this->memberID
- ;";
- $this->wpdb->query($sql);
+ // Also update all member info records with any possible name change
+ $sql = "
+ UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member_info
+ SET member_name = '".addslashes($memberData['fieldData']['name'])."'
+ WHERE member = $this->memberID
+ ;";
+ $this->wpdb->query($sql);
- $memberName = $memberData['fieldData']['name'];
+ $memberName = $memberData['fieldData']['name'];
+
+ } else {
+ $memberUpdateError = true;
+ }
- } else {
- $memberUpdateError = true;
- }
+ glmClearShortcodeCache();
break;
$categories2[$k]['selected'] = false;
}
}
-
+
// Check for action option - Should be one of the values in the "switch" statement below
if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
$option = $_REQUEST['option'];
}
-
+
/*
* Perform requested action
*/
}
+ glmClearShortcodeCache();
+
break;
// Add the new member information record
do_action( 'glm-member-db-member-info-save-custom-fields', $this->memberInfoID );
}
+ glmClearShortcodeCache();
break;
* 'menu' => '{menu name}', // Menu name in this context is simply where to find the action
* 'action' => '{shortcode action name}, // Action used to execute this shortcode
* 'table' => '{table prefix}{table name}', // Database table where default attribute values are stored
- * 'cacheControl' => array( // Short code output cache control
+ * 'cacheControl' => array( // Short code output cache control - Most code for this is in front controller
* 'active' => true, // Enable cache for this shortcode
* 'cacheTime' => '1 HOUR' // Cache refresh time - MySQL "DATE_ADD" time interval - see https://www.w3schools.com/sql/func_date_add.asp
* ),
'table' => GLM_MEMBERS_PLUGIN_DB_PREFIX.'settings_general',
'cacheControl' => array(
'active' => true,
- 'cacheTime' => '30 DAYS' // MySQL "DATE_ADD" time interval - see https://www.w3schools.com/sql/func_date_add.asp
+ 'cacheTime' => '2 WEEK' // MySQL "DATE_ADD" time interval - see https://www.w3schools.com/sql/func_date_add.asp
),
'attributes' => array(
'type' => false,