Hi,

I noticed what It seems to be a bug with Drupal 6 and the profile system.

I have an action that save some profile hidden field depending on others visible field that the user fill when it edit his account.

Look especially to the end of code of my action :

  drupal_set_message('<pre>'.print_r($fields, true).'</pre>');
  drupal_set_message('<pre>'.print_r(user_save($updated_user, $fields), true).'</pre>');

And look now the output when the action is triggered :

Output of $fields

#

Array
(
    [profile_api_status] => Error
    [profile_charname1] => 
    [profile_charid1] => 
    [profile_corpname1] => 
    [profile_corpid1] => 
    [profile_gender1] => 
    [profile_race1] => 
    [profile_bloodline1] => 
    [profile_balance1] => 
    [profile_charname2] => 
    [profile_charid2] => 
    [profile_corpname2] => 
    [profile_corpid2] => 
    [profile_gender2] => 
    [profile_race2] => 
    [profile_bloodline2] => 
    [profile_balance2] => 
    [profile_charname3] => 
    [profile_charid3] => 
    [profile_corpname3] => 
    [profile_corpid3] => 
    [profile_gender3] => 
    [profile_race3] => 
    [profile_bloodline3] => 
    [profile_balance3] => 
)

Output of user_save() (values with XXX are correct but hidden for confidentiality)

#

stdClass Object
(
    [uid] => 1
    [name] => xxx
    [pass] => xxx
    [mail] => xxx
    [mode] => 0
    [sort] => 0
    [threshold] => 0
    [theme] => 
    [signature] => 
    [created] => 1212881907
    [access] => 1213438867
    [login] => 1213032137
    [status] => 1
    [timezone] => 
    [language] => 
    [picture] => 
    [init] => xxx
    [data] => xxx
    [timezone_name] => 
    [form_build_id] => form-77bc32e7ca371f0ca0739eaebdd40b8c
    [profile_api_status] => Error
    [roles] => Array
        (
            [2] => authenticated user
        )

    [profile_uid] => xxx
    [profile_api] => xxx
    [profile_charname1] => xxx
    [profile_charid1] => xxx
    [profile_corpname1] => xxx
    [profile_corpid1] => xxx
    [profile_gender1] => xxx
    [profile_race1] => xxx
    [profile_bloodline1] => xxx
    [profile_balance1] => xxx
    [profile_base-attributes1] => xxx
    [profile_attributes-enhancers1] => xxx
    [profile_total-attributes1] => xxx
    [profile_skills1] => xxx
)

You can see that only profile fields with "1" terminaison are filled, whereas my $fields table contain the 1, 2, and 3...

See the attached screenshot to see that my profile fields are correctly set up in administration.

It's a very strange bug and I have absolutely no ideas of what can cause this strange behavior, I really need help.

Thank you

zmove

CommentFileSizeAuthor
#1 screen1.png11.87 KBzmove

Comments

zmove’s picture

StatusFileSize
new11.87 KB

Problem with attached picture upload, this is not the first time....

zmove’s picture

After some bug tracking, I point out what could be the cause of the problem.

The fact to save empty field seems to be the cause of the issue. If, for my fields, I save the string 'error' instead of an empty string, it works.

So do I use the wrong way to save empty fields for user (maybe there is another dedicated function), or it is a bug in the behavior of user_save ?

gábor hojtsy’s picture

Version: 6.2 » 6.x-dev
Category: bug » support
Priority: Critical » Normal

This is a development support request. Recategorizing.

ainigma32’s picture

Status: Active » Postponed (maintainer needs more info)

@zmove: looking at the age if this issue I hope you figured this out already. Can you confirm?

- Arie

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Looks like zmove won't be posting any feedback so I'm setting this to fixed.

Feel free to reopen if you think that is wrong.

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.