Drupal7: functions related to (programmatic) user management

Keywords

Drupal7 has pretty good out-of-the-box user and user account configuration options for most basic web sites (including configurable email templates for communication with users about accounts), but as soon as work on more complex sites with specific user/business requirements you have going to have to get you hands dirty with low-level user functions and/or user-related Rules.

But Drupal7 has a simply pitiful lack of object-oriented encapsulation, which leads to the utterly embarrassing need to document in text (or by examining the database table fields) the structure of a $user (ahem) "object" in plain text. Yep, that's in the 2nd decade of the 21st century.

Or you can use the dpm() family of debug functions to have a gander at a $user if the Devel module is enabled. See also [node/38].

There are a lot of functions in the user.module, you are unlikely to need most of them; good places to start are user_load() and user_save(), which calls the very useful hook_user_update():

A user account was updated.

Modules may use this hook to update their user data in a custom storage after a user account has been updated.

Visit also