update to log only get request
authorSteve Sutton <steve@gaslightmedia.com>
Fri, 6 Sep 2019 20:44:13 +0000 (16:44 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Fri, 6 Sep 2019 20:44:13 +0000 (16:44 -0400)
post may have newlines and that messes things up a bit.

controllers/admin.php

index 2a48404..cfccaba 100755 (executable)
@@ -1122,11 +1122,16 @@ class glmMembersAdmin extends GlmPluginSupport
 
     }
 
+    /**
+     * Log the User Actions
+     */
     public function logUserActions()
     {
+        if ( isset( $_REQUEST['page'] ) && $_REQUEST['page'] == 'glm-members-admin-menu-logs' ) {
+            return;
+        }
         $user_id      = get_current_user_id();
         if ( !empty( $user_id ) ) {
-            // $logFile   = WP_CONTENT_DIR . '/user.log';
             $logFile   = GLM_MEMBERS_PLUGIN_MEDIA_PATH . '/' . date('Y-m-d') . '-user.log';
             $timeZone  = get_option( 'timezone_string' );
             $cTimezone = date_default_timezone_get();
@@ -1134,16 +1139,14 @@ class glmMembersAdmin extends GlmPluginSupport
 
             $errorLogTime = date( 'j-M-Y H:i:s e' );
 
-            if ( !empty( $_POST ) ) {
-                $type     = 'POST';
-                $typeData = $_POST;
+            if ( !empty( $_POST['option'] ) ) {
+                $_GET['option'] = $_POST['option'];
             }
-            if ( !empty( $_GET ) ) {
-                $type = 'GET';
-                $typeData = $_GET;
+            if ( !empty( $_POST['glm_action'] ) ) {
+                $_GET['glm_action'] = $_POST['glm_action'];
             }
 
-            error_log( "[{$errorLogTime}]\tIP: {$_SERVER['REMOTE_ADDR']}\tUSER: {$user_id}\t{$type}: " . serialize( $typeData ) . "\n", 3, $logFile );
+            error_log( "[{$errorLogTime}]\tIP: {$_SERVER['REMOTE_ADDR']}\tUSER: {$user_id}\tGET: " . serialize( $_GET ) . "\n", 3, $logFile );
         }
         date_default_timezone_set( $cTimezone );
     }