WordPress 3.0 beta 1 documentation kindly provided to you by Hay Kranen
| [ Index ] |
PHP Cross Reference of WordPress 3.0 beta 1 |
|
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Source view] [Print] [Project Stats]
WordPress User API
| File Size: | 873 lines (28 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| wp_signon( $credentials = '', $secure_cookie = '' ) X-Ref |
| Authenticate user with remember capability. The credentials is an array that has 'user_login', 'user_password', and 'remember' indices. If the credentials is not given, then the log in form will be assumed and used if set. The various authentication cookies will be set by this function and will be set for a longer period depending on if the 'remember' credential is set to true. param: array $credentials Optional. User info in order to sign on. param: bool $secure_cookie Optional. Whether to use secure cookie. return: object Either WP_Error on failure, or WP_User on success. |
| wp_authenticate_username_password($user, $username, $password) X-Ref |
| Authenticate the user using the username and password. |
| wp_authenticate_cookie($user, $username, $password) X-Ref |
| Authenticate the user using the WordPress auth cookie. |
| count_user_posts($userid) X-Ref |
| Number of posts user has written. param: int $userid User ID. return: int Amount of posts user has written. |
| count_many_users_posts($users) X-Ref |
| Number of posts written by a list of users. param: array $userid User ID number list. return: array Amount of posts each user has written. |
| user_pass_ok($user_login, $user_pass) X-Ref |
| Check that the user login name and password is correct. param: string $user_login User name. param: string $user_pass User password. return: bool False if does not authenticate, true if username and password authenticates. |
| get_user_option( $option, $user = 0, $deprecated = '' ) X-Ref |
| Retrieve user option that can be either per Site or per Network. If the user ID is not given, then the current user will be used instead. If the user ID is given, then the user data will be retrieved. The filter for the result, will also pass the original option name and finally the user data object as the third parameter. The option will first check for the per site name and then the per Network name. param: string $option User option name. param: int $user Optional. User ID. param: bool $deprecated Use get_option() to check for an option in the options table. return: mixed |
| update_user_option( $user_id, $option_name, $newvalue, $global = false ) X-Ref |
| Update user option with global blog capability. User options are just like user metadata except that they have support for global blog options. If the 'global' parameter is false, which it is by default it will prepend the WordPress table prefix to the option name. param: int $user_id User ID param: string $option_name User option name. param: mixed $newvalue User option value. param: bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). return: unknown |
| delete_user_option( $user_id, $option_name, $global = false ) X-Ref |
| Delete user option with global blog capability. User options are just like user metadata except that they have support for global blog options. If the 'global' parameter is false, which it is by default it will prepend the WordPress table prefix to the option name. param: int $user_id User ID param: string $option_name User option name. param: bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). return: unknown |
| get_users_of_blog( $id = '' ) X-Ref |
| Get users for the blog. For setups that use the multi-blog feature. Can be used outside of the multi-blog feature. param: int $id Blog ID. return: array List of users that are part of that Blog ID |
| add_user_meta($user_id, $meta_key, $meta_value, $unique = false) X-Ref |
| Add meta data field to a user. Post meta data is called "Custom Fields" on the Administration Panels. param: int $user_id Post ID. param: string $key Metadata name. param: mixed $value Metadata value. param: bool $unique Optional, default is false. Whether the same key should not be added. return: bool False for failure. True for success. |
| delete_user_meta($user_id, $meta_key, $meta_value = '') X-Ref |
| Remove metadata matching criteria from a user. You can match based on the key, or key and value. Removing based on key and value, will keep from removing duplicate metadata with the same key. It also allows removing all metadata matching key, if needed. param: int $user_id user ID param: string $meta_key Metadata name. param: mixed $meta_value Optional. Metadata value. return: bool False for failure. True for success. |
| get_user_meta($user_id, $key, $single = false) X-Ref |
| Retrieve user meta field for a user. param: int $user_id Post ID. param: string $key The meta key to retrieve. param: bool $single Whether to return a single value. return: mixed Will be an array if $single is false. Will be value of meta data field if $single |
| update_user_meta($user_id, $meta_key, $meta_value, $prev_value = '') X-Ref |
| Update user meta field based on user ID. Use the $prev_value parameter to differentiate between meta fields with the same key and user ID. If the meta field for the user does not exist, it will be added. param: int $user_id Post ID. param: string $key Metadata key. param: mixed $value Metadata value. param: mixed $prev_value Optional. Previous value to check before removing. return: bool False on failure, true if success. |
| count_users($strategy = 'time') X-Ref |
| Count number of users who have each of the user roles. Assumes there are neither duplicated nor orphaned capabilities meta_values. Assumes role names are unique phrases. Same assumption made by WP_User_Search::prepare_query() Using $strategy = 'time' this is CPU-intensive and should handle around 10^7 users. Using $strategy = 'memory' this is memory-intensive and should handle around 10^5 users, but see WP Bug #12257. param: string $strategy 'time' or 'memory' return: array Includes a grand total and an array of counts indexed by role strings. |
| setup_userdata($for_user_id = '') X-Ref |
| Set up global user vars. Used by set_current_user() for back compat. Might be deprecated in the future. param: int $for_user_id Optional. User ID to set up global data. |
| wp_dropdown_users( $args = '' ) X-Ref |
| Create dropdown HTML content of users. The content can either be displayed, which it is by default or retrieved by setting the 'echo' argument. The 'include' and 'exclude' arguments do not need to be used; all users will be displayed in that case. Only one can be used, either 'include' or 'exclude', but not both. The available arguments are as follows: <ol> <li>show_option_all - Text to show all and whether HTML option exists.</li> <li>show_option_none - Text for show none and whether HTML option exists. </li> <li>orderby - SQL order by clause for what order the users appear. Default is 'display_name'.</li> <li>order - Default is 'ASC'. Can also be 'DESC'.</li> <li>include - User IDs to include.</li> <li>exclude - User IDs to exclude.</li> <li>multi - Default is 'false'. Whether to skip the ID attribute on the 'select' element. A 'true' value is overridden when id argument is set.</li> <li>show - Default is 'display_name'. User table column to display. If the selected item is empty then the user_login will be displayed in parentesis</li> <li>echo - Default is '1'. Whether to display or retrieve content.</li> <li>selected - Which User ID is selected.</li> <li>name - Default is 'user'. Name attribute of select element.</li> <li>id - Default is the value of the 'name' parameter. ID attribute of select element.</li> <li>class - Class attribute of select element.</li> <li>blog_id - ID of blog (Multisite only). Defaults to ID of current blog.</li> </ol> param: string|array $args Optional. Override defaults. return: string|null Null on display. String of HTML content on retrieve. |
| _fill_user( &$user ) X-Ref |
| Add user meta data as properties to given user object. The finished user data is cached, but the cache is not used to fill in the user data for the given object. Once the function has been used, the cache should be used to retrieve user data. The intention is if the current data had been cached already, there would be no need to call this function. param: object $user The user data object. |
| get_user_metavalues($ids) X-Ref |
| Perform the query to get the $metavalues array(s) needed by _fill_user and _fill_many_users param: array $ids User ID numbers list. return: array of arrays. The array is indexed by user_id, containing $metavalues object arrays. |
| _fill_single_user( &$user, &$metavalues ) X-Ref |
| Unserialize user metadata, fill $user object, then cache everything. param: object $user The User object. param: array $metavalues An array of objects provided by get_user_metavalues() |
| _fill_many_users( &$users ) X-Ref |
| Take an array of user objects, fill them with metas, and cache them. param: array $users User objects param: array $metas User metavalues objects |
| sanitize_user_object($user, $context = 'display') X-Ref |
| Sanitize every user field. If the context is 'raw', then the user object or array will get minimal santization of the int fields. param: object|array $user The User Object or Array param: string $context Optional, default is 'display'. How to sanitize user fields. return: object|array The now sanitized User Object or Array (will be the same type as $user) |
| sanitize_user_field($field, $value, $user_id, $context) X-Ref |
| Sanitize user field based on context. Possible context values are: 'raw', 'edit', 'db', 'display', 'attribute' and 'js'. The 'display' context is used by default. 'attribute' and 'js' contexts are treated like 'display' when calling filters. param: string $field The user Object field name. param: mixed $value The user Object value. param: int $user_id user ID. param: string $context How to sanitize user fields. Looks for 'raw', 'edit', 'db', 'display', return: mixed Sanitized value. |
| update_user_caches(&$user) X-Ref |
| Update all user caches param: object $user User object to be cached |
| clean_user_cache($id) X-Ref |
| Clean all user caches param: int $id User ID |
| Generated: Mon Apr 5 14:26:09 2010 | Cross-referenced by PHPXref 0.7 |