You are here

Example: User API in Examples for Developers 6

Examples using user API. (drupal 6)

This module shows how to save information to the database that can be attached to users when they are loaded with user_load().

In Drupal 7 and forward, this functionality would be accomplished by attaching a field to the user entity, either in code or through the Drupal UI.

Parent topics

File

user_example/user_example.module, line 8
An example of the User API.

Functions

Namesort descending Location Description
user_example_install user_example/user_example.install Implementation of hook_install().
user_example_menu user_example/user_example.module Implementation of hook_menu().
user_example_page user_example/user_example.module Page callback to display information about this module. In "real" modules, user hook_help() or the Advanced Help module instead of hardcoded page callbacks.
user_example_schema user_example/user_example.install Implementation of hook_schema().
user_example_uninstall user_example/user_example.install Implementation of hook_uninstall().
user_example_user user_example/user_example.module Implementation of hook_user().
_user_example_add_color_element user_example/user_example.module Helper function to add a "What is your favorite color?" dropdown to the user edit form.
_user_example_color_save user_example/user_example.module Save a user's favorite color to the database.
_user_example_color_validate user_example/user_example.module Validate that the user selected a valid favorite color. Note that this is called from hook_user('validate') so we can validate data saved both through the user edit form and data saved by calls to user_save().