Answers:
使用user_save
Drupal功能,您可以像这样创建新用户:
$new_user = array(
'name' => 'JohnDoe',
'mail' => 'john.doe@email.com',
'pass' => 'password123',
'status' => 1,
'field_custom_first_name' => array(LANGUAGE_NONE => array(array('value' => 'John'))), // This becomes $account->field_custom_first_name[LANGUAGE_NONE][0]['value']
'field_custom_last_name' => array(LANGUAGE_NONE => array(array('value' => 'Doe'))),
'access' => REQUEST_TIME,
'roles' => array(), // No other roles than Authenticated
//'roles' => array('10' => '10', '11' => '11'), // If you want to specify additional roles, the numbers are role_id's
);
user_save(NULL, $new_user);
access
做,我已经从user_save页面上对do的注释中复制了此注释并对其进行了修改,因此我对它的作用不是100%access
。我要假设这是最后访问日期,所以如果是新用户,我猜应该不设置该日期。