Quantcast
Channel: Tips and Tricks
Viewing all articles
Browse latest Browse all 16

Create a user account in Drupal 7 programmatically

$
0
0
As a follow up to my post on how to create a user account in Drupal 6 programmatically, I ran into a situation where I needed to do this in Drupal 7. Pretty similar but a few differences. So here you go:
 
  //This will generate a random password, you could set your own here$password= user_password(8); 
  //set up the user fields$fields=array('name'=>'user_name','mail'=>'user_name@example.com','pass'=>$password,'status'=>1,'init'=>'email address',

Viewing all articles
Browse latest Browse all 16

Trending Articles