Drupal 6 Programmatically Create Users

How to programmatically create new users in Drupal 6:

'username',
'pass' => 'password', // note: do not md5 the password
'mail' => 'email address',
'status' => 1,
'init' => 'email address'
);
user_save(null, $newUser);
?>

To update an existing user:

some_property = 'what_you_want_to_set_it_to';

// save existing user
user_save((object) array('uid' => $existingUser->uid), (array) $existingUser);
?>

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s