Check for array first
authorSteve Sutton <steve@gaslightmedia.com>
Wed, 18 Apr 2018 14:15:35 +0000 (10:15 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Wed, 18 Apr 2018 14:15:35 +0000 (10:15 -0400)
Before using foreach.

classes/data/dataRegRequestRegistrant.php

index 4ce6be4..953c6d4 100644 (file)
@@ -358,8 +358,10 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract
                 // echo '<pre>$customData: ' . print_r( $customData, true ) . '</pre>';
                 if ( isset( $customData ) && is_array( $customData ) && !empty( $customData ) ) {
                     $fields = $customData['form'];
-                    foreach ( $fields as $cField ) {
-                        $custom_data[$cField['field_name']] = $cField['stored'];
+                    if ( isset( $fields ) && is_array( $fields ) ) {
+                        foreach ( $fields as $cField ) {
+                            $custom_data[$cField['field_name']] = $cField['stored'];
+                        }
                     }
                 }
                 // Check for level custom fields also