$area = cw_profile_fields_get_area($user); list($profile_sections, $profile_fields) = cw_profile_fields_get_sections('U', true, $area); $smarty->assign('profile_fields', $profile_fields); if ($action == 'update_contact_list') { $fill_error = array(); cw_array_map('trim', $contact_list); foreach ($profile_fields['contact_list'] as $k => $v) { if ($v['type'] == 'D' && empty($contact_list[$k]) && $v['is_avail'] && $v['is_required']) { $fill_error[$k] = true; } elseif ($v['type'] != 'D' && empty($contact_list['custom_fields'][$k]) && $v['is_avail'] && $v['is_required']) { $fill_error[$k] = true; } } $prefilled_contact_list = array(); if (count($fill_error)) { $top_message = array('type' => 'E', 'content' => cw_check_user_get_error($fill_error)); $prefilled_contact_list = $contact_list; cw_header_location("index.php?target={$target}&mode={$mode}&user={$user}&contact_list_id={$contact_list_id}"); } else { cw_user_update_contact_list($user, $contact_list_id, $contact_list); cw_header_location("index.php?target={$target}&mode={$mode}&user={$user}"); } } if ($action == 'delete' && is_array($del)) { foreach ($del as $contact_list_id => $val) { cw_user_delete_contact_list($user, $contact_list_id); } } if (isset($_GET['contact_list_id'])) { $smarty->assign('fill_error', $fill_error); $smarty->assign('contact_list_id', $contact_list_id);
} cw_user_update($new_profile, $user, $customer_id); // Sign in confirmation letter sending have to be apparently blocked if an user is fake if (!isset($is_anonymous) || $is_anonymous != 1) { cw_user_send_modification_mail($user, $is_new_profile); } cw_event('on_profile_modify', array($user, $new_profile)); if ($mode == 'add' && $is_anonymous) { $top_message_text = 'Please proceed to shipping and payment'; } else { $top_message_text = $mode == 'add' ? cw_get_langvar_by_name('msg_user_has_been_added_' . (empty($usertype) ? 'C' : $usertype)) : cw_get_langvar_by_name('msg_profile_upd'); } cw_add_top_message($top_message_text, 'I'); } else { $filled_profile = $update_fields; cw_add_top_message(cw_check_user_get_error($fill_error), 'E'); } if (AREA_TYPE == 'A') { if (empty($fill_error)) { $mode = 'modify'; } cw_header_location("index.php?target={$target}&mode={$mode}&user={$user}&js_tab={$js_tab}"); } elseif (defined('IS_AJAX')) { $customer_id = $user; cw_func_call('cw_checkout_login', array()); } else { cw_header_location("index.php?target={$target}" . ($mode ? "&mode={$mode}" : '') . "&js_tab={$js_tab}"); } } if ($action == "delete" && @$confirmed == "Y" && !empty($user)) { // TODO: move delete function to another controller