From: Steve Sutton Date: Wed, 18 Apr 2018 14:15:35 +0000 (-0400) Subject: Check for array first X-Git-Tag: v1.0.0^2~21 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=838418a9bc870559cbb762d83aa9be114f6bae7e;p=WP-Plugins%2Fglm-member-db-registrations.git Check for array first Before using foreach. --- diff --git a/classes/data/dataRegRequestRegistrant.php b/classes/data/dataRegRequestRegistrant.php index 4ce6be4..953c6d4 100644 --- a/classes/data/dataRegRequestRegistrant.php +++ b/classes/data/dataRegRequestRegistrant.php @@ -358,8 +358,10 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract // echo '
$customData: ' . print_r( $customData, true ) . '
'; 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