Now showing only first instance of Custom Fields filter called with debug. Use VERBOS... develop
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 28 Feb 2019 16:17:57 +0000 (11:17 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 28 Feb 2019 16:17:57 +0000 (11:17 -0500)
setup/commonHooks.php

index 39798b2..b21be5f 100644 (file)
@@ -202,8 +202,15 @@ add_filter( 'glm-members-customfields-form-store', function( $content, $fid, $re
  */
 add_filter( 'glm-members-customfields-form-data-recall', function( $content, $fid, $recordId = 0, $priorityDisplay = false ){
 
-    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
-        trigger_error('Custom Fields Filter Called: glm-members-customfields-form-data-recall', E_USER_NOTICE);
+    // If debug VERBOSE show all instances - othewise only the first.
+    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
+        trigger_error('Custom Fields Filter Called: (Verbose debug - showing all instances) glm-members-customfields-form-data-recall', E_USER_NOTICE);
+    } else {
+        static $customFieldsFilterCalled = false;
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && !$customFieldsFilterCalled) {
+            trigger_error('Custom Fields Filter Called: (shown only once - use GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE to show all instances) glm-members-customfields-form-data-recall', E_USER_NOTICE);
+            $customFieldsFilterCalled = true;
+        }
     }
 
     require_once GLM_MEMBERS_CUSTOMFIELDS_PLUGIN_CLASS_PATH.'/data/dataCustomFields.php';