Description
Returns an array of objects containing the details of each blog the specified user has access to.
Parameters
- $id
- (integer) (required) ID of user queried.
- Default: None
- $all
- (boolean) (optional) Show details of all blogs, regardless of their archive, spam or deleted status.
- Default: false
Return Values
- (array)
- An array of objects containing the following public variables:
- userblog_id
- (integer) ID of the blog the specified user has access to.
- blogname
- (string) The name of this blog.
- domain
- (string) Domain used to access this blog.
- path
- (string) Path used to access this blog.
- site_id
- (integer) ID of the site this blog belongs to (as wp_site).
- siteurl
- (string) The URL of the site this blog belongs to.
Usage
<?php get_blogs_of_user( 1 ); ?>
Examples
<?php
$user_id = 1;
$user_blogs = get_blogs_of_user( $user_id );
echo 'User '.$user_id.'\'s blogs:<ul>';
foreach ($user_blogs AS $user_blog) {
echo '<li>'.$user_blog->blogname.'</li>';
}
echo '</ul>';
?>
Notes
Uses get_blog_details() to access blog information.