Skip to main content
deleted 11 characters in body
Source Link
jivanrij
  • 157
  • 1
  • 12

I'm trying add a new user to drupal 7, here is my code:

$values = array('name' => $name, 'pass' => $password,  'mail' => $email, 'status'=>1);
$newUser = user_save('', $values);

But i also have the new field field_foobar, if i add it to the values array drupal does nothing with it. What is the correct drupal way of adding these values to my user object so that drupal saves them when i call the user_save function?

I also saw that the fields are stored in the same type of table that stores custom fields of nodes. Also can't get this done, but i guess these 2 problems can have the same solution.

Thanks, Jonathan!

I'm trying add a new user to drupal 7, here is my code:

$values = array('name' => $name, 'pass' => $password,  'mail' => $email, 'status'=>1);
$newUser = user_save('', $values);

But i also have the new field field_foobar, if i add it to the values array drupal does nothing with it. What is the correct drupal way of adding these values to my user object so that drupal saves them when i call the user_save function?

I also saw that the fields are stored in the same type of table that stores custom fields of nodes. Also can't get this done, but i guess these 2 problems can have the same solution.

Thanks, Jonathan

I'm trying add a new user to drupal 7, here is my code:

$values = array('name' => $name, 'pass' => $password,  'mail' => $email, 'status'=>1);
$newUser = user_save('', $values);

But i also have the new field field_foobar, if i add it to the values array drupal does nothing with it. What is the correct drupal way of adding these values to my user object so that drupal saves them when i call the user_save function?

I also saw that the fields are stored in the same type of table that stores custom fields of nodes. Also can't get this done, but i guess these 2 problems can have the same solution.

Thanks!

Tweeted twitter.com/#!/StackDrupal/status/235660578360799232
Source Link
jivanrij
  • 157
  • 1
  • 12

Saving custom fields for nodes and users

I'm trying add a new user to drupal 7, here is my code:

$values = array('name' => $name, 'pass' => $password,  'mail' => $email, 'status'=>1);
$newUser = user_save('', $values);

But i also have the new field field_foobar, if i add it to the values array drupal does nothing with it. What is the correct drupal way of adding these values to my user object so that drupal saves them when i call the user_save function?

I also saw that the fields are stored in the same type of table that stores custom fields of nodes. Also can't get this done, but i guess these 2 problems can have the same solution.

Thanks, Jonathan