Adding comments to new method
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 21 Aug 2019 14:53:55 +0000 (10:53 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 21 Aug 2019 14:53:55 +0000 (10:53 -0400)
Updating parameter name to status

classes/data/dataEvents.php

index 8cc4c7f..367e6f0 100644 (file)
@@ -726,15 +726,24 @@ class GlmDataEvents extends GlmDataAbstract
 
     }
 
-    public function updateStatus( $id, $newStatus )
+    /**
+     * Update the Status of an event
+     *
+     * @param $id     Integer Id of event
+     * @param $status Integer Status number from config/plugin.ini
+     *
+     */
+    public function updateStatus( $id, $status )
     {
-        $this->wpdb->update(
-            $this->table,
-            array( 'status' => $newStatus ),
-            array( 'id' => $id ),
-            array( '%d' ),
-            array( '%d' )
-        );
+        if ( filter_var( $id, FILTER_VALIDATE_INT ) && filter_var( $status, FILTER_VALIDATE_INT ) ) {
+            $this->wpdb->update(
+                $this->table,
+                array( 'status' => $status ),
+                array( 'id' => $id ),
+                array( '%d' ),
+                array( '%d' )
+            );
+        }
     }
 
     /**