get_blogs_of_user() should return false for logged out and non-existent users on single site. See #19160.

git-svn-id: http://svn.automattic.com/wordpress/trunk@19208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
duck_ 2011-11-07 23:05:13 +00:00
parent b8f091fcbc
commit e0b10ef8a7
1 changed files with 10 additions and 10 deletions

View File

@ -652,6 +652,16 @@ function get_users( $args = array() ) {
function get_blogs_of_user( $user_id, $all = false ) {
global $wpdb;
$user_id = (int) $user_id;
// Logged out users can't have blogs
if ( empty( $user_id ) )
return false;
$keys = get_user_meta( $user_id );
if ( empty( $keys ) )
return false;
if ( ! is_multisite() ) {
$blog_id = get_current_blog_id();
$blogs = array( $blog_id => new stdClass );
@ -664,16 +674,6 @@ function get_blogs_of_user( $user_id, $all = false ) {
return $blogs;
}
$user_id = (int) $user_id;
// Logged out users can't have blogs
if ( empty( $user_id ) )
return false;
$keys = get_user_meta( $user_id );
if ( empty( $keys ) )
return false;
$blogs = array();
if ( isset( $keys[ $wpdb->base_prefix . 'capabilities' ] ) && defined( 'MULTISITE' ) ) {