From ef8b235dce41ff62544aa4512c08669f11635ab3 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 5 Apr 2018 16:26:08 -0400 Subject: [PATCH] Minor required updates 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 | 20 +++++++++++-------- .../Authorize.Net/paymentGateway.php | 4 ++-- models/admin/member/index.php | 14 +++++++++---- views/admin/member/header.html | 2 +- 4 files changed, 25 insertions(+), 15 deletions(-) diff --git a/controllers/front.php b/controllers/front.php index 4e3e7024..f066eaf3 100644 --- a/controllers/front.php +++ b/controllers/front.php @@ -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; diff --git a/lib/paymentProcessors/Authorize.Net/paymentGateway.php b/lib/paymentProcessors/Authorize.Net/paymentGateway.php index ff5179f1..c7034e08 100644 --- a/lib/paymentProcessors/Authorize.Net/paymentGateway.php +++ b/lib/paymentProcessors/Authorize.Net/paymentGateway.php @@ -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; } diff --git a/models/admin/member/index.php b/models/admin/member/index.php index a9eae2f0..ff7f8036 100644 --- a/models/admin/member/index.php +++ b/models/admin/member/index.php @@ -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 diff --git a/views/admin/member/header.html b/views/admin/member/header.html index c6ac3eb4..958b737d 100644 --- a/views/admin/member/header.html +++ b/views/admin/member/header.html @@ -20,7 +20,7 @@ {/if}