get_blog_list

Definition:
function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {}

Parameters

  • $start
  • $num
  • $deprecated

Source code

function get_blog_list( $start = 0, $num = 10, $deprecated = '' ) {

	_deprecated_function( __FUNCTION__, '3.0' );



	global $wpdb;

	$blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );



	foreach ( (array) $blogs as $details ) {

		$blog_list[ $details['blog_id'] ] = $details;

		$blog_list[ $details['blog_id'] ]['postcount'] = $wpdb->get_var( "SELECT COUNT(ID) FROM " . $wpdb->get_blog_prefix( $details['blog_id'] ). "posts WHERE post_status='publish' AND post_type='post'" );

	}

	unset( $blogs );

	$blogs = $blog_list;



	if ( false == is_array( $blogs ) )

		return array();



	if ( $num == 'all' )

		return array_slice( $blogs, $start, count( $blogs ) );

	else

		return array_slice( $blogs, $start, $num );

}

1212

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: