diff --git a/wp-includes/admin-bar/admin-bar-class.php b/wp-includes/admin-bar/admin-bar-class.php index 2de9da71f3..4d3919b98c 100644 --- a/wp-includes/admin-bar/admin-bar-class.php +++ b/wp-includes/admin-bar/admin-bar-class.php @@ -12,7 +12,7 @@ class WP_Admin_Bar { $this->menu = new stdClass; /* Populate settings we need for the menu based on the current user. */ - $this->user->blogs = get_ordered_blogs_of_user( $current_user->id ); + $this->user->blogs = get_blogs_of_user( $current_user->id ); if ( is_multisite() ) { $this->user->active_blog = get_active_blog_for_user( $current_user->id ); $this->user->domain = empty( $this->user->active_blog ) ? user_admin_url() : trailingslashit( get_home_url( $this->user->active_blog->blog_id ) ); diff --git a/wp-includes/user.php b/wp-includes/user.php index c5fe577e48..21609c505f 100644 --- a/wp-includes/user.php +++ b/wp-includes/user.php @@ -637,83 +637,6 @@ function get_blogs_of_user( $id, $all = false ) { return apply_filters( 'get_blogs_of_user', $blog_deets, $id, $all ); } -function get_ordered_blogs_of_user( $user_id, $visibility = true ) { - $newblogs = $ordered = array(); - $blogs = get_blogs_of_user( $user_id ); - $order_meta = get_user_meta( $user_id, 'blog_order' ); - $visible_meta = get_user_meta( $user_id, 'blog_visibility' ); - - $order = $order_meta; - if ( !is_array( $order ) ) - $order = array(); - - $visible = $visible_meta; - if ( !is_array( $visible ) ) - $visible = array(); - - // Index the blogs by userblog_id and set the visibility flag - // Visibility is on by default, unless a linked site then off - foreach ( $blogs as $blog ) { - $blog->visible = true; - - if ( isset( $visible[$blog->userblog_id] ) ) - $blog->visible = $visible[$blog->userblog_id]; - - $newblogs[$blog->userblog_id] = $blog; - } - - // Add the blogs to our list by order - foreach ( (array)$order as $id ) { - // A previous change was saving the entire blog details into ordered, not just the blog ID - this detects it - if ( is_object( $id ) && isset( $id->userblog_id ) ) - $id = $id->userblog_id; - - if ( is_numeric( $id ) && isset( $newblogs[intval( $id )] ) ) { - $ordered[$id] = $newblogs[$id]; - unset( $newblogs[$id] ); - } - } - - // Add any blog not yet ordered to the end - foreach ( $newblogs as $blog ) { - $ordered[$blog->userblog_id] = $blog; - } - - // If we're only interested in visible blogs then remove the rest - if ( $visibility ) { - foreach ( (array)$ordered as $pos => $blog ) { - if ( $blog->visible == false ) - unset( $ordered[$pos] ); - } - } - -/* - // Set the order and visible options if the user doesn't have any, - // but rate limit it so that the global DB doesn't get hammered - if ( !is_array( $order_meta ) && ( 1 == mt_rand( 1, 10 ) ) ) - update_usermeta( $user_id, 'blog_order', array() ); - - if ( !is_array( $visible_meta ) && ( 1 == mt_rand( 1, 10 ) ) ) - update_usermeta( $user_id, 'blog_visibility', array() ); -*/ - - return apply_filters( 'ordered_blogs', $ordered ); -} - -function set_blog_visibility( $blog_id, $visible ) { - global $current_user; - - if ( is_blog_user( $blog_id ) ) { - $visibility = get_user_meta( $current_user->ID, 'blog_visibility' ); - if ( !is_array( $visibility ) ) - $visibility = array(); - - $visibility[$blog_id] = $visible; - - update_user_meta( $current_user->ID, 'blog_visibility', $visibility ); - } -} - /** * Checks if the current user belong to a given blog. *