41 | | * Insert an user into the database. |
42 | | * @global object $wpdb WordPress database layer. |
| 56 | * wp_insert_user() - Insert an user into the database. |
| 57 | * |
| 58 | * Can update a current user or insert a new user based on whether |
| 59 | * the user's ID is present. |
| 60 | * |
| 61 | * Can be used to update the user's info (see below), set the user's |
| 62 | * role, and set the user's preference on whether they want the rich |
| 63 | * editor on. |
| 64 | * |
| 65 | * Most of the $userdata array fields have filters associated with |
| 66 | * the values. The exceptions are 'rich_editing', 'role', 'jabber', |
| 67 | * 'aim', 'yim', 'user_registered', and 'ID'. The filters have the |
| 68 | * prefix 'pre_user_' followed by the field name. An example using |
| 69 | * 'description' would have the filter called, 'pre_user_description' |
| 70 | * that can be hooked into. |
| 71 | * |
| 72 | * The $userdata array can contain the following fields: |
| 73 | * 'ID' - An integer that will be used for updating an existing user. |
| 74 | * 'user_pass' - A string that contains the plain text password for the user. |
| 75 | * 'user_login' - A string that contains the user's username for logging in. |
| 76 | * 'user_nicename' - A string that contains a nicer looking name for the user. |
| 77 | * The default is the user's username. |
| 78 | * 'user_url' - A string containing the user's URL for the user's web site. |
| 79 | * 'user_email' - A string containing the user's email address. |
| 80 | * 'display_name' - A string that will be shown on the site. Defaults to user's username. |
| 81 | * It is likely that you will want to change this, for both appearance and security |
| 82 | * through obscurity (that is if you don't use and delete the default 'admin' user). |
| 83 | * 'nickname' - The user's nickname, defaults to the user's username. |
| 84 | * 'first_name' - The user's first name. |
| 85 | * 'last_name' - The user's last name. |
| 86 | * 'description' - A string containing content about the user. |
| 87 | * 'rich_editing' - A string for whether to enable the rich editor or not. False if not |
| 88 | * empty. |
| 89 | * 'user_registered' - The date the user registered. Format is 'Y-m-d H:i:s'. |
| 90 | * 'role' - A string used to set the user's role. |
| 91 | * 'jabber' - User's Jabber account. |
| 92 | * 'aim' - User's AOL IM account. |
| 93 | * 'yim' - User's Yahoo IM account. |
| 94 | * |
| 95 | * @since 2.0.0 |
| 96 | * @uses $wpdb WordPress database layer. |
| 97 | * @uses apply_filters() Calls filters for most of the $userdata fields with the prefix 'pre_user'. See note above. |
| 98 | * @uses do_action() Calls 'profile_update' hook when updating giving the user's ID |
| 99 | * @uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID |
| 100 | * |
143 | | * Update an user in the database. |
| 201 | * wp_update_user() - Update an user in the database |
| 202 | * |
| 203 | * It is possible to update a user's password by specifying the |
| 204 | * 'user_pass' value in the $userdata parameter array. |
| 205 | * |
| 206 | * If $userdata does not contain an 'ID' key, then a new user |
| 207 | * will be created and the new user's ID will be returned. |
| 208 | * |
| 209 | * If current user's password is being updated, then the cookies |
| 210 | * will be cleared. |
| 211 | * |
| 212 | * @since 2.0.0 |
| 213 | * @see wp_insert_user() For what fields can be set in $userdata |
| 214 | * @uses wp_insert_user() Used to update existing user or add new one if user doesn't exist already |
| 215 | * |