tag:blogger.com,1999:blog-7330761068601183997.post5000425766385435704..comments2023-11-05T01:12:06.020-07:00Comments on Chris Cohen's blog: Drupal 5: user_save and profile fieldsUnknownnoreply@blogger.comBlogger2125tag:blogger.com,1999:blog-7330761068601183997.post-77183362940544407592010-01-05T18:10:42.132-08:002010-01-05T18:10:42.132-08:00Actually, I just had to do this. You need to crea...Actually, I just had to do this. You need to create the account first...<br /><br />$account = user_save('',$user_array);<br /><br />And then save all of the category data to the account with a separate call each like so:<br /><br />user_save($account, $profile_data_1, 'Category 1');<br />user_save($account, $profile_data_2, 'Category 2');<br /><br />This will do what you want.Nicholas Vahalikhttps://www.blogger.com/profile/04862704546355480803noreply@blogger.comtag:blogger.com,1999:blog-7330761068601183997.post-14729408942730301012009-04-27T16:36:00.000-07:002009-04-27T16:36:00.000-07:00not tested, please consider to be pseudo code
//$...not tested, please consider to be pseudo code<br /><br />//$key corresponds to fid in profile_values table<br />if ($uid>0)<br />{<br />db_query('DELETE FROM {profile_values} WHERE uid = %d', $uid);<br />}<br />foreach($profile_fieldArray as $key=>$value){<br /> if (strlen($value)>0){<br /> db_query('INSERT INTO {profile_values} (fid, uid, value) VALUES (%d, %d, '%s')', $key, $uid, $value);<br /> }<br />}Dionnec7https://www.blogger.com/profile/10630849744345962246noreply@blogger.com