Make WordPress Core

Ticket #36707: 36707.diff

File 36707.diff, 1015 bytes (added by jeremyfelt, 8 years ago)
  • src/wp-includes/user.php

     
    578578        if ( empty( $user_id ) )
    579579                return array();
    580580
     581        /**
     582         * Filter the list of a user's sites before it is populated.
     583         *
     584         * Returning a populated array effectively short circuits `get_blogs_of_user()`.
     585         *
     586         * @since 4.6.0
     587         *
     588         * @param array $blogs   An array of WP_Site objects of which the user is a member. Default is an empty array.
     589         * @param int   $user_id User ID.
     590         * @param bool  $all     Whether the returned array should contain all sites, including
     591         *                       those marked 'deleted', 'archived', or 'spam'. Default false.
     592         */
     593        $blogs = apply_filters( 'pre_get_blogs_of_user', array(), $user_id, $all );
     594
     595        if ( is_array( $blogs ) && 0 < count( $blogs ) ) {
     596                return $blogs;
     597        }
     598
    581599        $keys = get_user_meta( $user_id );
    582600        if ( empty( $keys ) )
    583601                return array();