Minor required updates
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 5 Apr 2018 20:26:08 +0000 (16:26 -0400)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 5 Apr 2018 20:26:08 +0000 (16:26 -0400)
Changed last member ID storage from WP option to cookie.
Added time profiling debug output to front controller.
Minor update to Authorize.net payment gateway class to remove status code from status text in response data.

controllers/front.php
lib/paymentProcessors/Authorize.Net/paymentGateway.php
models/admin/member/index.php
views/admin/member/header.html

index 4e3e702..f066eaf 100644 (file)
@@ -284,8 +284,10 @@ class glmMembersFront extends GlmPluginSupport
     public function controller ($atts, $content = null, $shortcode)
     {
 
-        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
+            $controllerShortcode = $shortcode;
+            $controllerStartTime = microtime(true);
         }
 
         // Start with no cache_code - This prevents caching for subordinate controller hits
@@ -371,7 +373,7 @@ class glmMembersFront extends GlmPluginSupport
 
         $controlError = false;
 
-        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
             // Also turn on SQL error messages
             $this->wpdb->show_errors();
         }
@@ -435,7 +437,7 @@ class glmMembersFront extends GlmPluginSupport
                 )
             );
 
-            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
                 trigger_error("Executing Shortcode: $shortcode", E_USER_NOTICE);
             }
 
@@ -492,7 +494,7 @@ class glmMembersFront extends GlmPluginSupport
                 $modelName = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "$plugIn/models/front/$menuItem/$action.php";
                 $className = 'GlmMembersFront_' . $menuItem . '_' . $action;
 
-                if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
                     trigger_error("Model: $modelName", E_USER_NOTICE);
                 }
 
@@ -504,7 +506,7 @@ class glmMembersFront extends GlmPluginSupport
                     // Otherwise, load and run the model
                 } else {
 
-                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                    if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
                         trigger_error("Front Controller: Loading - Model = $modelName, Action = $action, Class = $className", E_USER_NOTICE);
                     }
 
@@ -533,7 +535,7 @@ class glmMembersFront extends GlmPluginSupport
                             // Set the new model action
                             $action = $results['modelRedirect'];
 
-                            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
                                 trigger_error("Model Redirect: ".$results['modelRedirect'], E_USER_NOTICE);
                             }
 
@@ -586,7 +588,7 @@ class glmMembersFront extends GlmPluginSupport
                                 $inTheme = '';
                             }
 
-                            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+                            if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
                                 trigger_error("View$inTheme: $viewPath", E_USER_NOTICE);
                             }
 
@@ -669,8 +671,10 @@ class glmMembersFront extends GlmPluginSupport
 
         }
 
-        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
             trigger_error(glmAssociateMemoryUsage(),E_USER_NOTICE);
+            $controllerTime = round(microtime(true) - $controllerStartTime, 6);
+            trigger_error($controllerTime." seconds - Shortcode: $controllerShortcode, Model class: $className ---", E_USER_NOTICE);
         }
 
         return $out;
index ff5179f..c7034e0 100644 (file)
@@ -706,7 +706,7 @@ class PaymentGateway
                     'customerProfileId' => $response->getCustomerProfileId(),
                     'paymentProfileId'  => $response->getCustomerPaymentProfileIdList()[0],
                     'profileStatus'     => true,
-                    'profileStatusText' => $errorMessages[0]->getCode().' '.$errorMessages[0]->getText()
+                    'profileStatusText' => $errorMessages[0]->getText()
                 );
                 return $resp;
 
@@ -716,7 +716,7 @@ class PaymentGateway
                     'customerProfileId' => false,
                     'paymentProfileId'  => false,
                     'profileStatus'     => false,
-                    'profileStatusText' => $errorMessages[0]->getCode().' '.$errorMessages[0]->getText()
+                    'profileStatusText' => $errorMessages[0]->getText()
                 );
                 return $resp;
             }
index a9eae2f..ff7f803 100644 (file)
@@ -132,8 +132,8 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
 
             if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'add') {
 
-               delete_option('glmMembersDatabaseMemberID');
                $memberID = 0;
+               setcookie("glmMembersDatabaseMemberID", $memberID, time()-3600);
 
             // Check if a redirecting model supplied the member ID
             } elseif (isset($actionData['memberID'])) {
@@ -148,7 +148,10 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
 
             } else {
 
-                $memberID = get_option('glmMembersDatabaseMemberID');
+                $memberID = 0;
+                if (isset($_COOKIE['glmMembersDatabaseMemberID']) && $_COOKIE['glmMembersDatabaseMemberID'] > 0) {
+                    $memberID = $_COOKIE['glmMembersDatabaseMemberID'];
+                }
 
             }
         }
@@ -301,6 +304,9 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
             }
         }
 
+        // ***** THIS IS ONLY TEMPORARY AS WE TRANSITION AWAY FROM OPTION FOR LAST MEMBER ID - Can be deleted at next update. ******
+        delete_option('glmMembersDatabaseMemberID');
+
         // If we have a member then also get a list of member info records
         $haveInfoRecords = false;
         $memberInfoRecords = false;
@@ -341,8 +347,8 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
                 $noActive = true;
             }
 
-            // Also save the mmeber ID in a WordPress "option" in case someone clicks the "Member" sub-menu
-            update_option('glmMembersDatabaseMemberID', $memberID);
+            // Also save the mmeber ID as a cookie
+            setcookie("glmMembersDatabaseMemberID", $memberID, time()+86400);
 
             /*
              * Get member view stats
index c6ac3eb..958b737 100644 (file)
@@ -20,7 +20,7 @@
 {/if}
 
     <h2 class="nav-tab-wrapper">
-        <a href="{$thisUrl}?page={$thisPage}" class="nav-tab{if $thisAction==index || $thisAction==memberEdit || $thisAction==memberInfo} nav-tab-active{/if}">{$terms.term_member_cap} Dashboard</a>
+        <a href="{$thisUrl}?page={$thisPage}&member={$memberID}" class="nav-tab{if $thisAction==index || $thisAction==memberEdit || $thisAction==memberInfo} nav-tab-active{/if}">{$terms.term_member_cap} Dashboard</a>
 {if $memberID}
   {foreach $addOnTabs as $a}
         <a href="{$thisUrl}?page={$thisPage}&glm_action={$a.action}{if isset($a.option)}&option={$a.option}{/if}&member={$memberID}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>