drupal 中 插入和更行一个用户信息(user_save)
$new_user =array(
'name' => $form_state['values']['name'],
'pass' => user_password(),
'mail' => $form_state['values']['mail'],
'init' => $form_state['values']['mail'],
'field_first_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_first_name']))),
'field_last_name' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_last_name']))),
'field_phone_number' => array(LANGUAGE_NONE => array(array('value' => $form_state['values']['field_phone_number']))),
'status' => 1,
'access' => REQUEST_TIME,
'roles' => $roles,
);
// $account returns user object(返回刚才插入的用户对象)
$account =user_save(null, $new_user);
这样表示更新一个用户信息
$account = user_save($account, $new_user);
参看官网(点击打开链接)