diff --git src/wp-admin/includes/dashboard.php src/wp-admin/includes/dashboard.php
index 5b13f686a1..2f3ba90bae 100644
--- src/wp-admin/includes/dashboard.php
+++ src/wp-admin/includes/dashboard.php
@@ -504,7 +504,7 @@ function wp_dashboard_quick_press( $error_msg = false ) {
 		$post    = get_default_post_to_edit( 'post', true );
 		$user_id = get_current_user_id();
 		// Don't create an option if this is a super admin who does not belong to this site.
-		if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) {
+		if ( in_array( get_current_blog_id(), get_blogs_of_user( $user_id, false, array( 'fields' => 'ids' ) ) ) )
 			update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
 		}
 	}
diff --git src/wp-admin/includes/ms.php src/wp-admin/includes/ms.php
index 8672946da5..6e75ebfe25 100644
--- src/wp-admin/includes/ms.php
+++ src/wp-admin/includes/ms.php
@@ -165,12 +165,12 @@ function wpmu_delete_user( $id ) {
 	 */
 	do_action( 'wpmu_delete_user', $id );
 
-	$blogs = get_blogs_of_user( $id );
+	$blogs_ids = get_blogs_of_user( $id, false, array( 'fields' => 'ids' ) );
 
-	if ( ! empty( $blogs ) ) {
-		foreach ( $blogs as $blog ) {
-			switch_to_blog( $blog->userblog_id );
-			remove_user_from_blog( $id, $blog->userblog_id );
+	if ( ! empty( $blogs_ids ) ) {
+		foreach ( $blogs_ids as $blog_id ) {
+			switch_to_blog( $blog_id );
+			remove_user_from_blog( $id, $blog_id );
 
 			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
 			foreach ( (array) $post_ids as $post_id ) {
@@ -626,7 +626,13 @@ function _access_denied_splash() {
 		return;
 	}
 
-	$blogs = get_blogs_of_user( get_current_user_id() );
+	/**
+	 * Filters arguments when getting user's blogs for access denied message.
+	 *
+	 * @param array $args An array of optional arguments used when getting blogs.
+	 */
+	$args = apply_filters( 'access_denied_splash_get_blogs_of_user_args', array() );
+	$blogs = get_blogs_of_user( get_current_user_id(), false, $args );
 
 	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
 		return;
@@ -804,9 +810,9 @@ function choose_primary_blog() {
 		<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
 		<td>
 		<?php
-		$all_blogs    = get_blogs_of_user( get_current_user_id() );
-		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
-		if ( count( $all_blogs ) > 1 ) {
+		$all_blogs_ids = get_blogs_of_user( get_current_user_id(), false, array( 'fields' => 'ids' ) );
+		$primary_blog  = get_user_meta( get_current_user_id(), 'primary_blog', true );
+		if ( count( $all_blogs_ids ) > 1 ) {
 			$found = false;
 			?>
 			<select name="primary_blog" id="primary_blog">
diff --git src/wp-admin/network/users.php src/wp-admin/network/users.php
index 7f212329f6..a4f5c19d1b 100644
--- src/wp-admin/network/users.php
+++ src/wp-admin/network/users.php
@@ -75,10 +75,10 @@ if ( isset( $_GET['action'] ) ) {
 								}
 
 								$userfunction = 'all_spam';
-								$blogs        = get_blogs_of_user( $user_id, true );
-								foreach ( (array) $blogs as $details ) {
-									if ( $details->userblog_id != get_network()->site_id ) { // main blog not a spam !
-										update_blog_status( $details->userblog_id, 'spam', '1' );
+								$blogs_ids    = get_blogs_of_user( $user_id, 'all_ids' );
+								foreach ( (array) $blogs_ids as $blog_id ) {
+									if ( $blog_id != get_network()->site_id ) { // main blog not a spam !
+										update_blog_status( $blog_id, 'spam', '1' );
 									}
 								}
 								update_user_status( $user_id, 'spam', '1' );
@@ -86,9 +86,9 @@ if ( isset( $_GET['action'] ) ) {
 
 							case 'notspam':
 								$userfunction = 'all_notspam';
-								$blogs        = get_blogs_of_user( $user_id, true );
+								$blogs_ids    = get_blogs_of_user( $user_id, 'all_ids' );
 								foreach ( (array) $blogs as $details ) {
-									update_blog_status( $details->userblog_id, 'spam', '0' );
+									update_blog_status( $blog_id, 'spam', '0' );
 								}
 
 								update_user_status( $user_id, 'spam', '0' );
diff --git src/wp-admin/user-new.php src/wp-admin/user-new.php
index 48387b0373..14de89e1d7 100644
--- src/wp-admin/user-new.php
+++ src/wp-admin/user-new.php
@@ -63,7 +63,7 @@ if ( isset( $_REQUEST['action'] ) && 'adduser' == $_REQUEST['action'] ) {
 	$redirect       = 'user-new.php';
 	$username       = $user_details->user_login;
 	$user_id        = $user_details->ID;
-	if ( $username != null && array_key_exists( $blog_id, get_blogs_of_user( $user_id ) ) ) {
+	if ( $username != null && in_array( $blog_id, get_blogs_of_user( $user_id, array( 'fields' => 'ids' ) ) ) ) {
 		$redirect = add_query_arg( array( 'update' => 'addexisting' ), 'user-new.php' );
 	} else {
 		if ( isset( $_POST['noconfirmation'] ) && current_user_can( 'manage_network_users' ) ) {
diff --git src/wp-includes/link-template.php src/wp-includes/link-template.php
index a56c9635ee..a6452f59e9 100644
--- src/wp-includes/link-template.php
+++ src/wp-includes/link-template.php
@@ -3600,14 +3600,15 @@ function set_url_scheme( $url, $scheme = null ) {
 function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
 	$user_id = $user_id ? (int) $user_id : get_current_user_id();
 
-	$blogs = get_blogs_of_user( $user_id );
-	if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs ) ) {
+	$blogs_exist = get_blogs_of_user( $user_id, false, array( 'number' => 1, 'fields' => 'ids' ) );
+	if ( is_multisite() && ! user_can( $user_id, 'manage_network' ) && empty( $blogs_exist ) ) {
 		$url = user_admin_url( $path, $scheme );
 	} elseif ( ! is_multisite() ) {
 		$url = admin_url( $path, $scheme );
 	} else {
 		$current_blog = get_current_blog_id();
-		if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ) ) ) ) {
+		$blogs_ids = get_blogs_of_user( $user_id, 'all_ids' );
+		if ( $current_blog  && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, $blogs_ids ) ) ) {
 			$url = admin_url( $path, $scheme );
 		} else {
 			$active = get_active_blog_for_user( $user_id );
diff --git src/wp-includes/ms-functions.php src/wp-includes/ms-functions.php
index eca785f201..f58b30ba8b 100644
--- src/wp-includes/ms-functions.php
+++ src/wp-includes/ms-functions.php
@@ -38,39 +38,39 @@ function get_sitestats() {
  * @return WP_Site|void The blog object
  */
 function get_active_blog_for_user( $user_id ) {
-	$blogs = get_blogs_of_user( $user_id );
-	if ( empty( $blogs ) ) {
+	$blogs_ids = get_blogs_of_user( $user_id, false, array( 'fields' => 'ids' ) );
+	if ( empty( $blogs_ids ) ) {
 		return;
 	}
 
 	if ( ! is_multisite() ) {
-		return $blogs[ get_current_blog_id() ];
+		return get_site( get_current_blog_id() );
 	}
 
-	$primary_blog = get_user_meta( $user_id, 'primary_blog', true );
-	$first_blog   = current( $blogs );
+	$primary_blog  = get_user_meta( $user_id, 'primary_blog', true );
+	$first_blog_id = current($blogs_ids);
 	if ( false !== $primary_blog ) {
-		if ( ! isset( $blogs[ $primary_blog ] ) ) {
-			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
-			$primary = get_site( $first_blog->userblog_id );
+		if ( ! in_array( $primary_blog, $blogs_ids ) ) {
+			update_user_meta( $user_id, 'primary_blog', $first_blog_id );
+			$primary = get_site( $first_blog_id );
 		} else {
 			$primary = get_site( $primary_blog );
 		}
 	} else {
 		//TODO Review this call to add_user_to_blog too - to get here the user must have a role on this blog?
-		$result = add_user_to_blog( $first_blog->userblog_id, $user_id, 'subscriber' );
+		$result = add_user_to_blog( $first_blog_id, $user_id, 'subscriber' );
 
 		if ( ! is_wp_error( $result ) ) {
-			update_user_meta( $user_id, 'primary_blog', $first_blog->userblog_id );
-			$primary = $first_blog;
+			update_user_meta( $user_id, 'primary_blog', $first_blog_id );
+			$primary = get_site( $first_blog_id );
 		}
 	}
 
 	if ( ( ! is_object( $primary ) ) || ( $primary->archived == 1 || $primary->spam == 1 || $primary->deleted == 1 ) ) {
-		$blogs = get_blogs_of_user( $user_id, true ); // if a user's primary blog is shut down, check their other blogs.
-		$ret   = false;
-		if ( is_array( $blogs ) && count( $blogs ) > 0 ) {
-			foreach ( (array) $blogs as $blog_id => $blog ) {
+		$blogs_ids = get_blogs_of_user( $user_id, true, array( 'fields' => 'ids' ) ); // if a user's primary blog is shut down, check their other blogs.
+		$ret       = false;
+		if ( is_array( $blogs_ids ) && count( $blogs_ids ) > 0 ) {
+			foreach ( (array) $blogs_ids as $blog_id ) {
 				if ( $blog->site_id != get_current_network_id() ) {
 					continue;
 				}
@@ -250,9 +250,9 @@ function remove_user_from_blog( $user_id, $blog_id = '', $reassign = '' ) {
 	if ( $primary_blog == $blog_id ) {
 		$new_id     = '';
 		$new_domain = '';
-		$blogs      = get_blogs_of_user( $user_id );
-		foreach ( (array) $blogs as $blog ) {
-			if ( $blog->userblog_id == $blog_id ) {
+		$user_blogs_ids = get_blogs_of_user($user_id, false, array( 'fields' => 'ids' ));
+		foreach ( (array) $user_blogs_ids as $user_blog_id ) {
+			if ( $user_blog_id == $blog_id ) {
 				continue;
 			}
 			$new_id     = $blog->userblog_id;
@@ -273,7 +273,7 @@ function remove_user_from_blog( $user_id, $blog_id = '', $reassign = '' ) {
 
 	$user->remove_all_caps();
 
-	$blogs = get_blogs_of_user( $user_id );
+	$blogs = get_blogs_of_user($user_id, false, array( 'fields' => 'ids' ));
 	if ( count( $blogs ) == 0 ) {
 		update_user_meta( $user_id, 'primary_blog', '' );
 		update_user_meta( $user_id, 'source_domain', '' );
@@ -1743,13 +1743,13 @@ function get_current_site() {
 function get_most_recent_post_of_user( $user_id ) {
 	global $wpdb;
 
-	$user_blogs       = get_blogs_of_user( (int) $user_id );
+	$user_blogs_ids   = get_blogs_of_user( (int) $user_id, false, array( 'fields' => 'ids' ) );
 	$most_recent_post = array();
 
 	// Walk through each blog and get the most recent post
 	// published by $user_id
-	foreach ( (array) $user_blogs as $blog ) {
-		$prefix      = $wpdb->get_blog_prefix( $blog->userblog_id );
+	foreach ( (array) $user_blogs_ids as $blog_id ) {
+		$prefix      = $wpdb->get_blog_prefix( $blog_id );
 		$recent_post = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_date_gmt FROM {$prefix}posts WHERE post_author = %d AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1", $user_id ), ARRAY_A );
 
 		// Make sure we found a post
@@ -1761,7 +1761,7 @@ function get_most_recent_post_of_user( $user_id ) {
 			// most recent post.
 			if ( ! isset( $most_recent_post['post_gmt_ts'] ) || ( $post_gmt_ts > $most_recent_post['post_gmt_ts'] ) ) {
 				$most_recent_post = array(
-					'blog_id'       => $blog->userblog_id,
+					'blog_id'       => $blog_id,
 					'post_id'       => $recent_post['ID'],
 					'post_date_gmt' => $recent_post['post_date_gmt'],
 					'post_gmt_ts'   => $post_gmt_ts,
diff --git src/wp-includes/user.php src/wp-includes/user.php
index 09be161e15..85ca2d54a6 100644
--- src/wp-includes/user.php
+++ src/wp-includes/user.php
@@ -597,13 +597,17 @@ function get_users( $args = array() ) {
  *
  * @global wpdb $wpdb WordPress database abstraction object.
  *
- * @param int  $user_id User ID
- * @param bool $all     Whether to retrieve all sites, or only sites that are not
- *                      marked as deleted, archived, or spam.
+ * @param int         $user_id User ID
+ * @param bool|string $all     Whether to retrieve all sites, or only sites that are not
+ *                             marked as deleted, archived, or spam. Alternatively can 
+ *                             force function to return just ids of all sites by using
+ *                             'all_ids' as value.
+ * @param array       $args    An array of optional arguments that will be passed to 
+ *                            'get_sites' function.
  * @return array A list of the user's sites. An empty array if the user doesn't exist
  *               or belongs to no sites.
  */
-function get_blogs_of_user( $user_id, $all = false ) {
+function get_blogs_of_user( $user_id, $all = false, $args = false ) {
 	global $wpdb;
 
 	$user_id = (int) $user_id;
@@ -621,12 +625,16 @@ function get_blogs_of_user( $user_id, $all = false ) {
 	 *
 	 * @since 4.6.0
 	 *
-	 * @param null|array $sites   An array of site objects of which the user is a member.
-	 * @param int        $user_id User ID.
-	 * @param bool       $all     Whether the returned array should contain all sites, including
-	 *                            those marked 'deleted', 'archived', or 'spam'. Default false.
+	 * @param null|array  $sites   An array of site objects of which the user is a member.
+	 * @param int         $user_id User ID.
+	 * @param bool|string $all     Whether the returned array should contain all sites, including
+	 *                             those marked 'deleted', 'archived', or 'spam'. Alternatively can 
+	 *                             force function to return just ids of all sites by using
+	 *                             'all_ids' as value.
+	 * @param array        $args   An array of optional arguments that will be passed to 
+	 *                             'get_sites' function.
 	 */
-	$sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all );
+	$sites = apply_filters( 'pre_get_blogs_of_user', null, $user_id, $all, $args );
 
 	if ( null !== $sites ) {
 		return $sites;
@@ -676,34 +684,55 @@ function get_blogs_of_user( $user_id, $all = false ) {
 		$site_ids[] = (int) $site_id;
 	}
 
+	if( $all === 'all_ids' )
+		return $site_ids;
+
 	$sites = array();
 
 	if ( ! empty( $site_ids ) ) {
-		$args = array(
+		$default_args = array(
 			'number'   => '',
 			'site__in' => $site_ids,
 		);
 		if ( ! $all ) {
-			$args['archived'] = 0;
-			$args['spam']     = 0;
-			$args['deleted']  = 0;
+			$default_args['archived'] = 0;
+			$default_args['spam']     = 0;
+			$default_args['deleted']  = 0;
 		}
 
+		$args = wp_parse_args( $args, $default_args );
+		/**
+		 * Filters the list of arguments that are passed to get_sites function.
+		 * 
+		 * @param array       $args    An array of optional arguments that will be passed to 
+		 *                             'get_sites' function.
+		 * @param int         $user_id User ID.
+		 * @param bool|string $all     Whether the returned array should contain all sites, including
+		 *                             those marked 'deleted', 'archived', or 'spam'. Alternatively can 
+		 *                             force function to return just ids of all sites by using
+		 *                             'all_ids' as value.
+		 */
+		$args = apply_filters( 'get_blogs_of_user_get_sites_args', $args, $user_id, $all );
+
 		$_sites = get_sites( $args );
 
-		foreach ( $_sites as $site ) {
-			$sites[ $site->id ] = (object) array(
-				'userblog_id' => $site->id,
-				'blogname'    => $site->blogname,
-				'domain'      => $site->domain,
-				'path'        => $site->path,
-				'site_id'     => $site->network_id,
-				'siteurl'     => $site->siteurl,
-				'archived'    => $site->archived,
-				'mature'      => $site->mature,
-				'spam'        => $site->spam,
-				'deleted'     => $site->deleted,
-			);
+		if( isset( $args[ 'fields' ] ) && $args[ 'fields' ] === 'ids' ) {
+			return $_sites;
+		} else {
+			foreach ( $_sites as $site ) {
+				$sites[ $site->id ] = (object) array(
+					'userblog_id' => $site->id,
+					'blogname'    => $site->blogname,
+					'domain'      => $site->domain,
+					'path'        => $site->path,
+					'site_id'     => $site->network_id,
+					'siteurl'     => $site->siteurl,
+					'archived'    => $site->archived,
+					'mature'      => $site->mature,
+					'spam'        => $site->spam,
+					'deleted'     => $site->deleted,
+				);
+			}
 		}
 	}
 
@@ -717,7 +746,7 @@ function get_blogs_of_user( $user_id, $all = false ) {
 	 * @param bool  $all     Whether the returned sites array should contain all sites, including
 	 *                       those marked 'deleted', 'archived', or 'spam'. Default false.
 	 */
-	return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all );
+	return apply_filters( 'get_blogs_of_user', $sites, $user_id, $all, $args );
 }
 
 /**
