/** * Build Array for user insertion into custom profile fields table */ public function build_insert_sql_array($cp_data) { $sql_not_in = array(); foreach ($cp_data as $key => $null) { $sql_not_in[] = strncmp($key, 'pf_', 3) === 0 ? substr($key, 3) : $key; } $sql = 'SELECT f.field_type, f.field_ident, f.field_default_value, l.lang_default_value FROM ' . $this->fields_language_table . ' l, ' . $this->fields_table . ' f WHERE l.lang_id = ' . $this->user->get_iso_lang_id() . ' ' . (sizeof($sql_not_in) ? ' AND ' . $this->db->sql_in_set('f.field_ident', $sql_not_in, true) : '') . ' AND l.field_id = f.field_id'; $result = $this->db->sql_query($sql); while ($row = $this->db->sql_fetchrow($result)) { $profile_field = $this->type_collection[$row['field_type']]; $cp_data['pf_' . $row['field_ident']] = $profile_field->get_default_field_value($row); } $this->db->sql_freeresult($result); return $cp_data; }