Create a user profile on user creation in drupal 6 I have a problem and can't seem to find the answer.
I'm creating a user via a rest service and it's not creating a user profile along with it.
I'm not sure how to even create the profile.
our user profiles have custom fields that i can pull with my user_get, but when i try to create a user with just a blank profile, it doesn't like it.

any help would be appreciated

function user_services_create_user() {
    $user_name = $input['user_name'];
    //the users email address
    $email = $input['email'];
    if(array_key_exists('password', $input)){
        $password = $input['password'];
    }
    else {
        $password = user_password(8);
    }

    //set up the user fields
    $fields = array(
        'name' =&gt; $user_name,
        'mail' =&gt; $email,
        'pass' =&gt; $password,
        'status' =&gt; 1,
    );
    //the first parameter is left blank so a new user is created
    $user_account = user_save('', $fields);
    if(!empty($user_account) &amp;&amp; $user_account-&gt;uid != '') {
        user_services_send_response('New user has been successfully created', 1, 200,    $user_account);
    }
    else {
        user_services_send_response('New user cannot be created. Please try again later', 0);
    }
}


Changed Code:

function user_services_create_user() {

//the user name of the new user
$user_name = $input['user_name'];
//the users email address
$email = $input['email'];
if(array_key_exists('password', $input)){
    $password = $input['password'];
}
else {
    $password = user_password(8);
}
user_services_check_user($input);
//set up the user fields
$fields = array(
    'name' =&gt; $user_name,
    'mail' =&gt; $email,
    'pass' =&gt; $password,
    'status' =&gt; 1,
);
//the first parameter is left blank so a new user is created
$user_account = user_save('', $fields);
if(!empty($user_account) &amp;&amp; $user_account-&gt;uid != '') {

    $node = new stdClass();
    $node-&gt;uid = $user_account-&gt;uid;
    $node-&gt;type='profile';
    $node-&gt;title=$user_account-&gt;name;
    $node-&gt;name=$user_account-&gt;name;
    $node-&gt;field_receipt_suppress_name[0]['value'] = user_fill_value_from_request('receipt_suppress_name');
    $node-&gt;field_receipt_suppress_points[0]['value'] = user_fill_value_from_request('receipt_suppress_points');
    $node-&gt;field_phone_number[0]['value'] = user_fill_value_from_request('phone_number');
    $node-&gt;field_first_name[0]['value'] = user_fill_value_from_request('first_name');
    $node-&gt;field_last_name[0]['value'] = user_fill_value_from_request('last_name');
    $node-&gt;field_user_phone_number[0]['value'] = user_fill_value_from_request('user_phone_number');
    $node-&gt;field_points[0]['value'] = user_fill_value_from_request('points');
    $node-&gt;field_date_points_last_checked[0]['value'] = user_fill_value_from_request('date_points_last_checked');
    $node-&gt;field_last_reward_issued_store[0]['nid'] = user_fill_value_from_request('last_reward_issued_store');
    $node-&gt;field_last_reward_issued_date[0]['value'] = user_fill_value_from_request('last_reward_issued_date');
    $node-&gt;field_last_reward_redeemed[0]['value'] = user_fill_value_from_request('last_reward_redeemed');
    $node-&gt;field_last_reward_redeemed_store[0]['nid'] = user_fill_value_from_request('last_reward_redeemed_store');
    $node-&gt;field_last_reward_redeemed_date[0]['value'] = user_fill_value_from_request('last_reward_redeemed_date');

    node_save($node);

    user_services_send_response('New user has been successfully created', 1, 200, $user_account);
}
else {
    user_services_send_response('New user cannot be created. Please try again later', 0);
}


}
Changed Code:

    function user_services_create_user() {

    //the user name of the new user
    $user_name = $input['user_name'];
    //the users email address
    $email = $input['email'];
    if(array_key_exists('password', $input)){
        $password = $input['password'];
    }
    else {
        $password = user_password(8);
    }
    user_services_check_user($input);
    //set up the user fields
    $fields = array(
        'name' =&gt; $user_name,
        'mail' =&gt; $email,
        'pass' =&gt; $password,
        'status' =&gt; 1,
    );
    //the first parameter is left blank so a new user is created
    $user_account = user_save('', $fields);
    if(!empty($user_account) &amp;&amp; $user_account-&gt;uid != '') {

        $node = new stdClass();
        $node-&gt;uid = $user_account-&gt;uid;
        $node-&gt;type='profile';
        $node-&gt;title=$user_account-&gt;name;
        $node-&gt;name=$user_account-&gt;name;
        $node-&gt;field_receipt_suppress_name[0]['value'] = user_fill_value_from_request('receipt_suppress_name');
        $node-&gt;field_receipt_suppress_points[0]['value'] = user_fill_value_from_request('receipt_suppress_points');
        $node-&gt;field_phone_number[0]['value'] = user_fill_value_from_request('phone_number');
        $node-&gt;field_first_name[0]['value'] = user_fill_value_from_request('first_name');
        $node-&gt;field_last_name[0]['value'] = user_fill_value_from_request('last_name');
        $node-&gt;field_user_phone_number[0]['value'] = user_fill_value_from_request('user_phone_number');
        $node-&gt;field_points[0]['value'] = user_fill_value_from_request('points');
        $node-&gt;field_date_points_last_checked[0]['value'] = user_fill_value_from_request('date_points_last_checked');
        $node-&gt;field_last_reward_issued_store[0]['nid'] = user_fill_value_from_request('last_reward_issued_store');
        $node-&gt;field_last_reward_issued_date[0]['value'] = user_fill_value_from_request('last_reward_issued_date');
        $node-&gt;field_last_reward_redeemed[0]['value'] = user_fill_value_from_request('last_reward_redeemed');
        $node-&gt;field_last_reward_redeemed_store[0]['nid'] = user_fill_value_from_request('last_reward_redeemed_store');
        $node-&gt;field_last_reward_redeemed_date[0]['value'] = user_fill_value_from_request('last_reward_redeemed_date');

        node_save($node);

        user_services_send_response('New user has been successfully created', 1, 200, $user_account);
    }
    else {
        user_services_send_response('New user cannot be created. Please try again later', 0);
    }
}