[ Index ]

PHP Cross Reference of Wordpress 2.9.1

title

Body

[close]

/wp-includes/ -> registration.php (summary)

User Registration API

File Size: 319 lines (10 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 7 functions

  username_exists()
  email_exists()
  validate_username()
  wp_insert_user()
  wp_update_user()
  wp_create_user()
  _wp_get_user_contactmethods()

Functions
Functions that are not part of a class:

username_exists( $username )   X-Ref
Checks whether the given username exists.

param: string $username Username.
return: null|int The user's ID on success, and null on failure.

email_exists( $email )   X-Ref
Checks whether the given email exists.

param: string $email Email.
return: bool|int The user's ID on success, and false on failure.

validate_username( $username )   X-Ref
Checks whether an username is valid.

param: string $username Username.
return: bool Whether username given is valid

wp_insert_user($userdata)   X-Ref
Insert an user into the database.

Can update a current user or insert a new user based on whether the user's ID
is present.

Can be used to update the user's info (see below), set the user's role, and
set the user's preference on whether they want the rich editor on.

Most of the $userdata array fields have filters associated with the values.
The exceptions are 'rich_editing', 'role', 'jabber', 'aim', 'yim',
'user_registered', and 'ID'. The filters have the prefix 'pre_user_' followed
by the field name. An example using 'description' would have the filter
called, 'pre_user_description' that can be hooked into.

The $userdata array can contain the following fields:
'ID' - An integer that will be used for updating an existing user.
'user_pass' - A string that contains the plain text password for the user.
'user_login' - A string that contains the user's username for logging in.
'user_nicename' - A string that contains a nicer looking name for the user.
The default is the user's username.
'user_url' - A string containing the user's URL for the user's web site.
'user_email' - A string containing the user's email address.
'display_name' - A string that will be shown on the site. Defaults to user's
username. It is likely that you will want to change this, for both
appearance and security through obscurity (that is if you don't use and
delete the default 'admin' user).
'nickname' - The user's nickname, defaults to the user's username.
'first_name' - The user's first name.
'last_name' - The user's last name.
'description' - A string containing content about the user.
'rich_editing' - A string for whether to enable the rich editor or not. False
if not empty.
'user_registered' - The date the user registered. Format is 'Y-m-d H:i:s'.
'role' - A string used to set the user's role.
'jabber' - User's Jabber account.
'aim' - User's AOL IM account.
'yim' - User's Yahoo IM account.

param: array $userdata An array of user data.
return: int The newly created user's ID.

wp_update_user($userdata)   X-Ref
Update an user in the database.

It is possible to update a user's password by specifying the 'user_pass'
value in the $userdata parameter array.

If $userdata does not contain an 'ID' key, then a new user will be created
and the new user's ID will be returned.

If current user's password is being updated, then the cookies will be
cleared.

param: array $userdata An array of user data.
return: int The updated user's ID.

wp_create_user($username, $password, $email = '')   X-Ref
A simpler way of inserting an user into the database.

Creates a new user with just the username, password, and email. For a more
detail creation of a user, use wp_insert_user() to specify more infomation.

param: string $username The user's username.
param: string $password The user's password.
param: string $email The user's email (optional).
return: int The new user's ID.

_wp_get_user_contactmethods()   X-Ref
Setup the default contact methods

return: array $user_contactmethods Array of contact methods and their labels.



Generated: Fri Jan 8 00:19:48 2010 Cross-referenced by PHPXref 0.7