WordPress.org

Make WordPress Core

Ticket #26099: 26099.2.patch

File 26099.2.patch, 3.3 KB (added by DrewAPicture, 8 years ago)

2nd pass + action docs

  • src/wp-admin/includes/user.php

     
    109109                $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) );
    110110
    111111        /* checking the password has been typed twice */
     112        /**
     113         * Fires before the password and confirm password fields are checked for congruity.
     114         *
     115         * @since 2.0.0
     116         *
     117         * @param string $user_login The username.
     118         * @param string &$pass1     The password, passed by reference.
     119         * @param string &$pass2     The confirmed password, passed by reference.
     120         */
    112121        do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) );
    113122
    114123        if ( $update ) {
     
    149158                $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) );
    150159        }
    151160
    152         // Allow plugins to return their own errors.
     161        /**
     162         * Fires before user profile update errors are returned.
     163         *
     164         * @since 2.8.0
     165         *
     166         * @param array   &$errors An array of user profile update errors, passed by reference.
     167         * @param bool    $update  Whether this is a user update.
     168         * @param WP_User &$user   WP_User object, passed by reference.
     169         */
    153170        do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) );
    154171
    155172        if ( $errors->get_error_codes() )
     
    184201        global $wp_roles;
    185202
    186203        $all_roles = $wp_roles->roles;
    187         $editable_roles = apply_filters('editable_roles', $all_roles);
    188204
     205        /**
     206         * Filter the list of editable roles.
     207         *
     208         * @since 2.8.0
     209         *
     210         * @param array $editable_roles List of roles.
     211         */
     212        $editable_roles = apply_filters( 'editable_roles', $all_roles );
     213
    189214        return $editable_roles;
    190215}
    191216
     
    217242function get_users_drafts( $user_id ) {
    218243        global $wpdb;
    219244        $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
    220         $query = apply_filters('get_users_drafts', $query);
     245
     246        /**
     247         * Filter the user's drafts query string.
     248         *
     249         * @since 2.0.0
     250         *
     251         * @param string $query The user's drafts query string.
     252         */
     253        $query = apply_filters( 'get_users_drafts', $query );
    221254        return $wpdb->get_results( $query );
    222255}
    223256
     
    245278                return false;
    246279
    247280        // allow for transaction statement
     281        /** This action is documented in wp-admin/includes/user.php */
    248282        do_action('delete_user', $id);
    249283
    250284        if ( 'novalue' === $reassign || null === $reassign ) {
     
    257291                        }
    258292                }
    259293
     294                /**
     295                 * Filter the list of post types to delete with a user.
     296                 *
     297                 * @since 3.4.0
     298                 *
     299                 * @param array $post_types_to_delete Post types to delete.
     300                 * @param int   $id                   User ID.
     301                 */
    260302                $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id );
    261303                $post_types_to_delete = implode( "', '", $post_types_to_delete );
    262304                $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) );
     
    302344        clean_user_cache( $user );
    303345
    304346        // allow for commit transaction
     347        /** This action is documented in wp-admin/includes/user.php */
    305348        do_action('deleted_user', $id);
    306349
    307350        return true;