Make WordPress Core

Ticket #26148: 26148.1.patch

File 26148.1.patch, 5.4 KB (added by morganestes, 12 years ago)

Refreshed patch with updates after other docs added.

  • wp-includes/user.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
     
    1919 * @since 2.5.0
    2020 *
    2121 * @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.
     22 * @param string $secure_cookie Optional. 'true' or 'false'; whether to use secure cookie.
     23 * @return \WP_Error|\WP_User WP_Error on failure, or WP_User on success.
    2424 */
    25 function wp_signon( $credentials = '', $secure_cookie = '' ) {
     25function wp_signon( $credentials = array(), $secure_cookie = '' ) {
    2626        if ( empty($credentials) ) {
    2727                if ( ! empty($_POST['log']) )
    2828                        $credentials['user_login'] = $_POST['log'];
     
    9999        return $user;
    100100}
    101101
     102add_filter( 'authenticate', 'wp_authenticate_username_password', 20, 3 );
     103
    102104/**
    103105 * Authenticate the user using the username and password.
     106 *
     107 * @since 2.8.0
     108 *
     109 * @param WP_User|object $user
     110 * @param $username
     111 * @param $password
     112 *
     113 * @return bool|mixed|void|WP_Error|WP_User
    104114 */
    105 add_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
    106 function wp_authenticate_username_password($user, $username, $password) {
     115function wp_authenticate_username_password( $user, $username, $password ) {
    107116        if ( is_a($user, 'WP_User') ) { return $user; }
    108117
    109118        if ( empty($username) || empty($password) ) {
     
    148157
    149158/**
    150159 * Authenticate the user using the WordPress auth cookie.
     160 *
     161 * @since 2.8.0
     162 *
     163 * @param WP_User|object $user
     164 * @param string $username
     165 * @param string $password
     166 *
     167 * @return WP_User|WP_Error The authenticated user, or an error.
    151168 */
    152 function wp_authenticate_cookie($user, $username, $password) {
     169function wp_authenticate_cookie( $user, $username, $password ) {
    153170        if ( is_a($user, 'WP_User') ) { return $user; }
    154171
    155172        if ( empty($username) && empty($password) ) {
     
    178195 * spammer, or if the user's primary blog has been marked as spam.
    179196 *
    180197 * @since 3.7.0
     198 *
     199 * @param WP_User|object $user The user to check for spam.
     200 *
     201 * @return WP_User|WP_Error The user if clean, error if spammy.
    181202 */
    182203function wp_authenticate_spam_check( $user ) {
    183204        if ( $user && is_a( $user, 'WP_User' ) && is_multisite() ) {
     
    341362 * Deletes the user option if $newvalue is empty.
    342363 *
    343364 * @since 2.0.0
    344  * @uses $wpdb WordPress database object for queries
     365 * @uses $wpdb WordPress database object for queries.
     366 * @see update_user_meta() for return value.
    345367 *
    346  * @param int $user_id User ID
     368 * @param int $user_id User ID.
    347369 * @param string $option_name User option name.
    348370 * @param mixed $newvalue User option value.
    349371 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
    350  * @return unknown
     372 *
     373 * @return int|bool Meta ID if the key didn't exist, true on successful update, false on failure.
    351374 */
    352375function update_user_option( $user_id, $option_name, $newvalue, $global = false ) {
    353376        global $wpdb;
     
    366389 * it will prepend the WordPress table prefix to the option name.
    367390 *
    368391 * @since 3.0.0
    369  * @uses $wpdb WordPress database object for queries
     392 * @uses $wpdb WordPress database object for queries.
     393 * @see delete_user_meta() for return value.
    370394 *
    371395 * @param int $user_id User ID
    372396 * @param string $option_name User option name.
    373397 * @param bool $global Optional. Whether option name is global or blog specific. Default false (blog specific).
    374  * @return unknown
     398 *
     399 * @return bool True on success, false on failure.
    375400 */
    376401function delete_user_option( $user_id, $option_name, $global = false ) {
    377402        global $wpdb;
     
    423448        var $query_limit;
    424449
    425450        /**
    426          * PHP5 constructor
     451         * PHP5 constructor.
    427452         *
    428453         * @since 3.1.0
    429454         *
    430          * @param string|array $args The query variables
     455         * @param string|array $query Optional. The query variables.
    431456         * @return WP_User_Query
    432457         */
    433458        function __construct( $query = null ) {
     
    438463        }
    439464
    440465        /**
    441          * Prepare the query variables
     466         * Prepare the query variables.
    442467         *
    443468         * @since 3.1.0
    444469         *
    445          * @param string|array $args The query variables
     470         * @param string|array $query Optional. The query variables.
    446471         */
    447472        function prepare_query( $query = array() ) {
    448473                global $wpdb;
     
    650675        }
    651676
    652677        /**
    653          * Execute the query, with the current variables
     678         * Execute the query, with the current variables.
    654679         *
    655680         * @since 3.1.0
     681         * @global wpdb $wpdb WordPress database object.
    656682         */
    657683        function query() {
    658684                global $wpdb;
     
    755781        }
    756782
    757783        /**
    758          * Return the list of users
     784         * Return the list of users.
    759785         *
    760786         * @since 3.1.0
    761787         * @access public
     
    767793        }
    768794
    769795        /**
    770          * Return the total number of users for the current query
     796         * Return the total number of users for the current query.
    771797         *
    772798         * @since 3.1.0
    773799         * @access public
     
    803829 * Get the blogs a user belongs to.
    804830 *
    805831 * @since 3.0.0
     832 * @global wpdb $wpdb The WordPress database object.
    806833 *
    807  * @param int $user_id User ID
     834 * @param int $user_id User ID.
    808835 * @param bool $all Whether to retrieve all blogs, or only blogs that are not marked as deleted, archived, or spam.
    809836 * @return array A list of the user's blogs. An empty array if the user doesn't exist or belongs to no blogs.
    810837 */