I am adding some custom fields to the iDesk user registration. I have successfully added them to the registration form, but I am unable to get them to update from the admin user profile screen. Please help.
Here is the code -
<?php
include_once "../application.php";
app::CleanRequestParams();
$pf = $_REQUEST['pf'];
$step = $_REQUEST['step'];
app:ef($pf, "update");
app:ef($step, 1);
$iDeskTpl->assign("pf", $pf);
app::ValidatePrivilege("user_prof");
/************************************************** *****************************
* Description : update
************************************************** *****************************/
if ($pf == "update")
{
if ($step == 2)
{
$company_name = $_REQUEST['company_name'];
$acct_number = $_REQUEST['acct_number'];
$address1 = $_REQUEST['address1'];
$address2 = $_REQUEST['address2'];
$city = $_REQUEST['city'];
$state = $_REQUEST['state'];
$zip = $_REQUEST['zip'];
$contact_name = $_REQUEST['contact_name'];
$contact_number = $_REQUEST['contact_number'];
$user_name = $_REQUEST['user_name'];
$email = $_REQUEST['email'];
$new_password = $_REQUEST['new_password'];
$confirm_password = $_REQUEST['confirm_password'];
$user_name = $_REQUEST['user_name'];
$email = $_REQUEST['email'];
$notify = $_REQUEST['notify'];
$signature = $_REQUEST['signature'];
form::IsEmpty("user_name");
if (form::IsEmpty('email'))
{
form::IsEmailAddress('email');
}
$query = "SELECT count(*) as col FROM {$cfg[table][user]}
WHERE email = '{$email}' AND user_id NOT IN ('{$_SESSION['usersession']['user_id']}')";
if ($conn->Lookup($query) > 0)
{
form::AddError($lang['error_email_exist']);
$iDeskTpl->assign("error", form::HandleError());
}
else
{
if ($new_password || $confirm_password)
{
if ($new_password != $confirm_password)
{
form::AddError($lang['error_password_not_match']);
}
}
if (form::IsError())
{
$iDeskTpl->assign("error", form::HandleError());
}
else
{
app::UpdateUserProfile($_SESSION['usersession']['user_id'], $user_name, $email,
$new_password, ($notify) ? 1 : 0, $signature);
$user = app::GetUser($_SESSION['usersession']['user_id']);
$receiver = app::GetReceiver($user['user_id']);
$subjectmail = app::GetEmailTemplateSubject("change_profile");
$bodymail = app::GetEmailTemplateBody("change_profile", "", $receiver);
app::SendEmail($email, $subjectmail, $bodymail);
setcookie("COOKIE_USERNAME", $user_name, $_COOKIE['COOKIE_EXPIRED'], "/");
setcookie("COOKIE_EMAIL", $email, $_COOKIE['COOKIE_EXPIRED'], "/");
if ($new_password)
{
setcookie("COOKIE_PASSWORD", $new_password, $_COOKIE['COOKIE_EXPIRED'], "/");
}
url::Redirect('confirmation.php?confirmation=user_ profile&user_name=' . $user_name);
}
}
}
$user = app::GetUser($_SESSION['usersession']['user_id']);
$iDeskTpl->assign("company_name", $user['company_name']);
$iDeskTpl->assign("acct_number", $user['acct_number']);
$iDeskTpl->assign("address1", $user['address1']);
$iDeskTpl->assign("address2", $user['address2']);
$iDeskTpl->assign("city", $user['city']);
$iDeskTpl->assign("state", $user['state']);
$iDeskTpl->assign("zip", $user['zip']);
$iDeskTpl->assign("contact_name", $user['comtact_name']);
$iDeskTpl->assign("contact_number", $user['contact_number']);
$iDeskTpl->assign("user_name", $user['user_name']);
$iDeskTpl->assign('email', $user['email']);
$iDeskTpl->assign("notify", ($user['notify']) ? "checked" : "");
$iDeskTpl->assign("signature", $user['signature']);
$iDeskTpl->display('admin/user_profile.html');
}
?>
Am I missing something?


ef($pf, "update");
