WordPress.org

Ready to get started?Download WordPress

Codex

Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get active blog for user

Description

Get one of a user's active blogs

Returns the user's primary blog, if she has one and it is active. If it's inactive, function returns another active blog of the user. If none are found, the user is added as a Subscriber to the Dashboard Blog and that blog is returned.

Usage

<?php get_active_blog_for_user$user_id ); ?>

Parameters

$user_id
(int) (required) The unique ID of the user
Default: None

Return Values

(object) 
The blog object
  stdClass Object
  (
      [blog_id] => 1
      [site_id] => 1
      [domain] => example-domain.com
      [path] => /
      [registered] => 2013-12-02 19:00:48
      [last_updated] => 2013-12-02 19:37:43
      [public] => 1
      [archived] => 0
      [mature] => 0
      [spam] => 0
      [deleted] => 0
      [lang_id] => 0
      [blogname] => Example Site Name
      [siteurl] => http://example-domain.com
      [post_count] => 9
  )

Change Log

Since: 1.0

Source File

get_active_blog_for_user() is located in wp-includes/ms-functions.php