Results 1 to 2 of 2

Thread: Custome Field in idesk

  1. #1
    Join Date
    Jul 2008
    Posts
    2

    Default Custome Field in idesk

    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?

  2. #2
    Join Date
    Apr 2008
    Posts
    20

    Default re: Custome Field in idesk

    Please check the parameters for :

    app::UpdateUserProfile($_SESSION['usersession']['user_id'], $user_name, $email,$new_password, ($notify) ? 1 : 0, $signature);

    You must have all of your variable you want to update entered the UpdateUserProfile function at app.php. Check whether UpdateUserProfile function has all of your variable processed into sql query accordingly. That is assuming you have created all of the necessary columns at user table.

    Then, make sure that $user variable at this line has all of the information you need:

    $user = app::GetUser($_SESSION['usersession']['user_id']);

Similar Threads

  1. iDesk 1.6 released
    By Bruceper in forum Announcements
    Replies: 0
    Last Post: 07-08-2008, 01:02 AM
  2. iDesk + IndexU
    By dePaulus in forum Pre-Sales Questions
    Replies: 1
    Last Post: 05-15-2008, 10:35 PM
  3. iDesk 1.5 released
    By Bruceper in forum Announcements
    Replies: 1
    Last Post: 03-27-2008, 10:30 PM
  4. idesk and indexu
    By jhanna in forum v5.x
    Replies: 0
    Last Post: 04-27-2007, 01:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •