[support] Drupal API - Create user

Daniel Carrera daniel.carrera at zmsl.com
Thu Dec 11 13:27:09 UTC 2008


Hello,

I'm reading the Drupal API for creating a new user:

http://api.drupal.org/api/function/user_save/5

I have a few questions:

1) If I'm creating a new user, can I just set $account to be an empty array?

2) Which fields do I have to put in $array? Which fields are optional? I 
ran user_fields() to figure out what fields are available for $array. 
This is what  I got:

User fields: uid, name, pass, mail, mode, sort, threshold, theme, 
signature, created, access, login, status, timezone, language, picture, 
init, data

I plan to include only name, pass, mail and login. Is it ok to exclude 
the others? I don't even know what some of the other fields are.

3) If I want to make a custom script that uses the Drupal API, which 
file do I need to include? I can't just include "user.module", clearly 
that file depends on others.

Thanks,
Daniel.


More information about the support mailing list