From 28703e4b5142f61bb09f87bd7d7492a467e24d6e Mon Sep 17 00:00:00 2001 From: tschiemer Date: Sun, 22 Sep 2013 18:16:01 +0200 Subject: [PATCH] Fix: on user insertion: do not fail if no custom data passed but custom columns defined for user account table. --- .../application/models/flexi_auth_model.php | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/library_files/application/models/flexi_auth_model.php b/library_files/application/models/flexi_auth_model.php index 0bfb9ea..b330cb1 100644 --- a/library_files/application/models/flexi_auth_model.php +++ b/library_files/application/models/flexi_auth_model.php @@ -196,14 +196,17 @@ public function insert_user($email, $username, $password, $custom_data = FALSE, } // Loop through custom data columns for the main user table set via config file. - foreach($this->auth->tbl_custom_col_user_account as $column) - { - if (array_key_exists($column, $custom_data)) - { - $sql_insert[$column] = $custom_data[$column]; - unset($custom_data[$column]); - } - } + if ( is_array($custom_data)) + { + foreach($this->auth->tbl_custom_col_user_account as $column) + { + if (array_key_exists($column, $custom_data)) + { + $sql_insert[$column] = $custom_data[$column]; + unset($custom_data[$column]); + } + } + } // Create main user account. $this->db->insert($this->auth->tbl_user_account, $sql_insert);