| | 8 | /** |
| | 9 | * Authenticate user with remember capability. |
| | 10 | * |
| | 11 | * The credentials is an array that has 'user_login', 'user_password', and |
| | 12 | * 'remember' indices. If the credentials is not given, then the log in form |
| | 13 | * will be assumed and used if set. |
| | 14 | * |
| | 15 | * The various authentication cookies will be set by this function and will be |
| | 16 | * set for a longer period depending on if the 'remember' credential is set to |
| | 17 | * true. |
| | 18 | * |
| | 19 | * @since 2.5.0 |
| | 20 | * |
| | 21 | * @param array $credentials Optional. User info in order to sign on. |
| | 22 | * @param bool $secure_cookie Optional. Whether to use secure cookie. |
| | 23 | * @return object Either WP_Error on failure, or WP_User on success. |
| | 24 | */ |
| | 86 | /** |
| | 87 | * Retrieve user data based on field. |
| | 88 | * |
| | 89 | * Use get_profile() will make a database query to get the value of the table |
| | 90 | * column. The value might be cached using the query cache, but care should be |
| | 91 | * taken when using the function to not make a lot of queries for retrieving |
| | 92 | * user profile information. |
| | 93 | * |
| | 94 | * If the $user parameter is not used, then the user will be retrieved from a |
| | 95 | * cookie of the user. Therefore, if the cookie does not exist, then no value |
| | 96 | * might be returned. Sanity checking must be done to ensure that when using |
| | 97 | * get_profile() that empty/null/false values are handled and that something is |
| | 98 | * at least displayed. |
| | 99 | * |
| | 100 | * @since 1.5.0 |
| | 101 | * @uses $wpdb WordPress database object to create queries. |
| | 102 | * |
| | 103 | * @param string $field User field to retrieve. |
| | 104 | * @param string $user Optional. User username. |
| | 105 | * @return string The value in the field. |
| | 106 | */ |
| 77 | | // TODO: xmlrpc only. Maybe move to xmlrpc.php. |
| 78 | | function user_pass_ok($user_login,$user_pass) { |
| | 129 | /** |
| | 130 | * Check that the user login name and password is correct. |
| | 131 | * |
| | 132 | * @since 0.71 |
| | 133 | * @todo xmlrpc only. Maybe move to xmlrpc.php. |
| | 134 | * |
| | 135 | * @param string $user_login User name. |
| | 136 | * @param string $user_pass User password. |
| | 137 | * @return bool False if does not authenticate, true if username and password authenticates. |
| | 138 | */ |
| | 139 | function user_pass_ok($user_login, $user_pass) { |
| | 151 | /** |
| | 152 | * Retrieve user option that can be either global, user, or blog. |
| | 153 | * |
| | 154 | * If the user ID is not given, then the current user will be used instead. If |
| | 155 | * the user ID is given, then the user data will be retrieved. The filter for |
| | 156 | * the result, will also pass the original option name and finally the user data |
| | 157 | * object as the third parameter. |
| | 158 | * |
| | 159 | * The option will first check for the non-global name, then the global name, |
| | 160 | * and if it still doesn't find it, it will try the blog option. The option can |
| | 161 | * either be modified or set by a plugin. |
| | 162 | * |
| | 163 | * @since 2.0.0 |
| | 164 | * @uses $wpdb WordPress database object for queries. |
| | 165 | * @uses apply_filters() Calls 'get_user_option_$option' hook with result, |
| | 166 | * option parameter, and user data object. |
| | 167 | * |
| | 168 | * @param string $option User option name. |
| | 169 | * @param int $user Optional. User ID. |
| | 170 | * @return mixed |
| | 171 | */ |
| | 191 | /** |
| | 192 | * Update user option with global blog capability. |
| | 193 | * |
| | 194 | * User options are just like user metadata except that they have support for |
| | 195 | * global blog options. If the 'global' parameter is false, which it is by false |
| | 196 | * it will prepend the WordPress table prefix to the option name. |
| | 197 | * |
| | 198 | * @since 2.0.0 |
| | 199 | * @uses $wpdb WordPress database object for queries |
| | 200 | * |
| | 201 | * @param int $user_id User ID |
| | 202 | * @param string $option_name User option name. |
| | 203 | * @param mixed $newvalue User option value. |
| | 204 | * @param bool $global Optional. Whether option name is blog specific or not. |
| | 205 | * @return unknown |
| | 206 | */ |
| 116 | | // Get users with capabilities for the current blog. |
| 117 | | // For setups that use the multi-blog feature. |
| | 214 | /** |
| | 215 | * Get users for the blog. |
| | 216 | * |
| | 217 | * For setups that use the multi-blog feature. Can be used outside of the |
| | 218 | * multi-blog feature. |
| | 219 | * |
| | 220 | * @since 2.2.0 |
| | 221 | * @uses $wpdb WordPress database object for queries |
| | 222 | * @uses $blog_id The Blog id of the blog for those that use more than one blog |
| | 223 | * |
| | 224 | * @param int $id Blog ID. |
| | 225 | * @return array List of users that are part of that Blog ID |
| | 226 | */ |
| | 270 | /** |
| | 271 | * Retrieve user metadata. |
| | 272 | * |
| | 273 | * If $user_id is not a number, then the function will fail over with a 'false' |
| | 274 | * boolean return value. Other returned values depend on whether there is only |
| | 275 | * one item to be returned, which be that single item type. If there is more |
| | 276 | * than one metadata value, then it will be list of metadata values. |
| | 277 | * |
| | 278 | * @since 2.0.0 |
| | 279 | * @uses $wpdb WordPress database object for queries. |
| | 280 | * |
| | 281 | * @param int $user_id User ID |
| | 282 | * @param string $meta_key Optional. Metadata key. |
| | 283 | * @return mixed |
| | 284 | */ |
| | 319 | /** |
| | 320 | * Update metadata of user. |
| | 321 | * |
| | 322 | * There is no need to serialize values, they will be serialized if it is |
| | 323 | * needed. The metadata key can only be a string with underscores. All else will |
| | 324 | * be removed. |
| | 325 | * |
| | 326 | * Will remove the metadata, if the meta value is empty. |
| | 327 | * |
| | 328 | * @since 2.0.0 |
| | 329 | * @uses $wpdb WordPress database object for queries |
| | 330 | * |
| | 331 | * @param int $user_id User ID |
| | 332 | * @param string $meta_key Metadata key. |
| | 333 | * @param mixed $meta_value Metadata value. |
| | 334 | * @return bool True on successful update, false on failure. |
| | 335 | */ |
| 219 | | // Setup global user vars. Used by set_current_user() for back compat. |
| | 371 | /** |
| | 372 | * Setup global user vars. |
| | 373 | * |
| | 374 | * Used by set_current_user() for back compat. Might be deprecated in the |
| | 375 | * future. |
| | 376 | * |
| | 377 | * @since 2.0.4 |
| | 378 | * @global string $userdata User description. |
| | 379 | * @global string $user_login The user username for logging in |
| | 380 | * @global int $user_level The level of the user |
| | 381 | * @global int $user_ID The ID of the user |
| | 382 | * @global string $user_email The email address of the user |
| | 383 | * @global string $user_url The url in the user's profile |
| | 384 | * @global string $user_pass_md5 MD5 of the user's password |
| | 385 | * @global string $user_identity The display name of the user |
| | 386 | * |
| | 387 | * @param int $user_id Optional. User ID to setup global data. |
| | 388 | */ |
| | 410 | /** |
| | 411 | * Create dropdown HTML content of users. |
| | 412 | * |
| | 413 | * The content can either be displayed, which it is by default or retrieved by |
| | 414 | * setting the 'echo' argument. The 'include' and 'exclude' arguments do not |
| | 415 | * need to be used; all users will be displayed in that case. Only one can be |
| | 416 | * used, either 'include' or 'exclude', but not both. |
| | 417 | * |
| | 418 | * The available arguments are as follows: |
| | 419 | * <ol> |
| | 420 | * <li>show_option_all - Text to show all and whether HTML option exists.</li> |
| | 421 | * <li>show_option_none - Text for show none and whether HTML option exists. |
| | 422 | * </li> |
| | 423 | * <li>orderby - SQL order by clause for what order the users appear. Default is |
| | 424 | * 'display_name'.</li> |
| | 425 | * <li>order - Default is 'ASC'. Can also be 'DESC'.</li> |
| | 426 | * <li>include - User IDs to include.</li> |
| | 427 | * <li>exclude - User IDs to exclude.</li> |
| | 428 | * <li>show - Default is 'display_name'. User table column to display.</li> |
| | 429 | * <li>echo - Default is '1'. Whether to display or retrieve content.</li> |
| | 430 | * <li>selected - Which User ID is selected.</li> |
| | 431 | * <li>name - Default is 'user'. Name attribute of select element.</li> |
| | 432 | * <li>class - Class attribute of select element.</li> |
| | 433 | * </ol> |
| | 434 | * |
| | 435 | * @since 2.3.0 |
| | 436 | * @uses $wpdb WordPress database object for queries |
| | 437 | * |
| | 438 | * @param string|array $args Optional. Override defaults. |
| | 439 | * @return string|null Null on display. String of HTML content on retrieve. |
| | 440 | */ |
| | 506 | /** |
| | 507 | * Add user meta data as properties to given user object. |
| | 508 | * |
| | 509 | * The finished user data is cached, but the cache is not used to fill in the |
| | 510 | * user data for the given object. Once the function has been used, the cache |
| | 511 | * should be used to retrieve user data. The purpose seems then to be to ensure |
| | 512 | * that the data in the object is always fresh. |
| | 513 | * |
| | 514 | * @access private |
| | 515 | * @since 2.5.0 |
| | 516 | * @uses $wpdb WordPress database object for queries |
| | 517 | * |
| | 518 | * @param object $user The user data object. |
| | 519 | */ |