Ticket #26148: 26148.2.patch
| File 26148.2.patch, 8.3 KB (added by , 12 years ago) |
|---|
-
src/wp-includes/user.php
20 20 * 21 21 * @param array $credentials Optional. User info in order to sign on. 22 22 * @param bool $secure_cookie Optional. Whether to use secure cookie. 23 * @return object Either WP_Error on failure, or WP_User on success.23 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 24 24 */ 25 function wp_signon( $credentials = '', $secure_cookie = '' ) {25 function wp_signon( $credentials = array(), $secure_cookie = '' ) { 26 26 if ( empty($credentials) ) { 27 27 if ( ! empty($_POST['log']) ) 28 28 $credentials['user_login'] = $_POST['log']; … … 37 37 else 38 38 $credentials['remember'] = false; 39 39 40 // TODO do we deprecate the wp_authentication action?41 40 /** 42 41 * Fires before the user is authenticated. 43 42 * … … 101 100 102 101 /** 103 102 * Authenticate the user using the username and password. 103 * 104 * @since 2.8.0 105 * 106 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 107 * @param string $username Username for authentication. 108 * @param string $password Password for authentication. 109 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 104 110 */ 105 add_filter('authenticate', 'wp_authenticate_username_password', 20, 3); 106 function wp_authenticate_username_password($user, $username, $password) { 107 if ( is_a($user, 'WP_User') ) { return $user; } 111 function wp_authenticate_username_password( $user, $username, $password ) { 112 if ( is_a( $user, 'WP_User' ) ) { 113 return $user; 114 } 108 115 109 116 if ( empty($username) || empty($password) ) { 110 117 if ( is_wp_error( $user ) ) … … 148 155 149 156 /** 150 157 * Authenticate the user using the WordPress auth cookie. 158 * 159 * @since 2.8.0 160 * 161 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 162 * @param string $username Username. If passed, cancels the cookie authentication. 163 * @param string $password Password. If passed, cancels the cookie authentication. 164 * @return WP_User|WP_Error WP_User on success, WP_Error on failure. 151 165 */ 152 function wp_authenticate_cookie($user, $username, $password) { 153 if ( is_a($user, 'WP_User') ) { return $user; } 166 function wp_authenticate_cookie( $user, $username, $password ) { 167 if ( is_a( $user, 'WP_User' ) ) { 168 return $user; 169 } 154 170 155 171 if ( empty($username) && empty($password) ) { 156 172 $user_id = wp_validate_auth_cookie(); … … 178 194 * spammer, or if the user's primary blog has been marked as spam. 179 195 * 180 196 * @since 3.7.0 197 * 198 * @param WP_User|WP_Error|null $user WP_User or WP_Error object from a previous callback. Default null. 199 * @return WP_User|WP_Error WP_User on success, WP_Error if the user is considered a spammer. 181 200 */ 182 201 function wp_authenticate_spam_check( $user ) { 183 202 if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) { … … 201 220 * Number of posts user has written. 202 221 * 203 222 * @since 3.0.0 204 * @ uses$wpdb WordPress database object for queries.223 * @global $wpdb WordPress database object for queries. 205 224 * 206 225 * @param int $userid User ID. 207 226 * @return int Amount of posts user has written. … … 288 307 * The option will first check for the per site name and then the per Network name. 289 308 * 290 309 * @since 2.0.0 291 * @ uses$wpdb WordPress database object for queries.310 * @global $wpdb WordPress database object for queries. 292 311 * @uses apply_filters() Calls 'get_user_option_$option' hook with result, 293 312 * option parameter, and user data object. 294 313 * … … 295 314 * @param string $option User option name. 296 315 * @param int $user Optional. User ID. 297 316 * @param bool $deprecated Use get_option() to check for an option in the options table. 298 * @return mixed 317 * @return mixed User option value on success, false on failure. 299 318 */ 300 319 function get_user_option( $option, $user = 0, $deprecated = '' ) { 301 320 global $wpdb; … … 341 360 * Deletes the user option if $newvalue is empty. 342 361 * 343 362 * @since 2.0.0 344 * @ uses $wpdb WordPress database object for queries363 * @global $wpdb WordPress database object for queries. 345 364 * 346 * @param int $user_id User ID 365 * @param int $user_id User ID. 347 366 * @param string $option_name User option name. 348 367 * @param mixed $newvalue User option value. 349 368 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 350 * @return unknown369 * @return int|bool User meta ID if the key didn't exist, true on successful update, false on failure. 351 370 */ 352 371 function update_user_option( $user_id, $option_name, $newvalue, $global = false ) { 353 372 global $wpdb; … … 366 385 * it will prepend the WordPress table prefix to the option name. 367 386 * 368 387 * @since 3.0.0 369 * @ uses$wpdb WordPress database object for queries388 * @global $wpdb WordPress database object for queries 370 389 * 371 390 * @param int $user_id User ID 372 391 * @param string $option_name User option name. 373 392 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific). 374 * @return unknown393 * @return bool True on success, false on failure. 375 394 */ 376 395 function delete_user_option( $user_id, $option_name, $global = false ) { 377 396 global $wpdb; … … 423 442 var $query_limit; 424 443 425 444 /** 426 * PHP5 constructor 445 * PHP5 constructor. 427 446 * 428 447 * @since 3.1.0 429 448 * 430 * @param string|array $args The query variables449 * @param string|array $args Optional. The query variables. 431 450 * @return WP_User_Query 432 451 */ 433 452 function __construct( $query = null ) { … … 438 457 } 439 458 440 459 /** 441 * Prepare the query variables 460 * Prepare the query variables. 442 461 * 443 462 * @since 3.1.0 444 463 * 445 * @param string|array $args The query variables464 * @param string|array $args Optional. The query variables. 446 465 */ 447 466 function prepare_query( $query = array() ) { 448 467 global $wpdb; … … 650 669 } 651 670 652 671 /** 653 * Execute the query, with the current variables 672 * Execute the query, with the current variables. 654 673 * 655 674 * @since 3.1.0 675 * @global $wpdb WordPress database object for queries. 656 676 */ 657 677 function query() { 658 678 global $wpdb; … … 755 775 } 756 776 757 777 /** 758 * Return the list of users 778 * Return the list of users. 759 779 * 760 780 * @since 3.1.0 761 781 * @access public … … 767 787 } 768 788 769 789 /** 770 * Return the total number of users for the current query 790 * Return the total number of users for the current query. 771 791 * 772 792 * @since 3.1.0 773 793 * @access public … … 783 803 * Retrieve list of users matching criteria. 784 804 * 785 805 * @since 3.1.0 786 * @uses $wpdb787 806 * @uses WP_User_Query See for default arguments and information. 788 807 * 789 808 * @param array $args Optional. … … 803 822 * Get the blogs a user belongs to. 804 823 * 805 824 * @since 3.0.0 825 * @global $wpdb WordPress database object for queries. 806 826 * 807 827 * @param int $user_id User ID 808 828 * @param bool $all Whether to retrieve all blogs, or only blogs that are not marked as deleted, archived, or spam. … … 1151 1171 * </ol> 1152 1172 * 1153 1173 * @since 2.3.0 1154 * @ uses $wpdb WordPress database object for queries1174 * @global $wpdb WordPress database object for queries. 1155 1175 * 1156 1176 * @param string|array $args Optional. Override defaults. 1157 1177 * @return string|null Null on display. String of HTML content on retrieve. … … 1390 1410 * Checks whether the given email exists. 1391 1411 * 1392 1412 * @since 2.1.0 1393 * @uses $wpdb1394 1413 * 1395 1414 * @param string $email Email. 1396 1415 * @return bool|int The user's ID on success, and false on failure. … … 1457 1476 * 'yim' - User's Yahoo IM account. 1458 1477 * 1459 1478 * @since 2.0.0 1460 * @ uses $wpdb WordPress database layer.1479 * @global $wpdb WordPress database object for queries. 1461 1480 * @uses apply_filters() Calls filters for most of the $userdata fields with the prefix 'pre_user'. See note above. 1462 1481 * @uses do_action() Calls 'profile_update' hook when updating giving the user's ID 1463 1482 * @uses do_action() Calls 'user_register' hook when creating a new user giving the user's ID … … 1838 1857 * hashing process. This field is now hashed; old values are no longer accepted 1839 1858 * but have a different WP_Error code so good user feedback can be provided. 1840 1859 * 1841 * @ uses $wpdb WordPress Database object1860 * @global $wpdb WordPress database object for queries. 1842 1861 * 1843 1862 * @param string $key Hash to validate sending user's password. 1844 1863 * @param string $login The user login.