BP_Blogs_Blog::get_blog_ids_for_user( int $user_id )

Get IDs of all of a user’s blogs, as tracked by BuddyPress.

Description Description

This method always includes hidden blogs.

Top ↑

Parameters Parameters


(int) (Optional) ID of the user whose blogs are being queried. Defaults to logged-in user.

Top ↑

Return Return

(int) The number of blogs associated with the user.

Source Source

File: bp-blogs/classes/class-bp-blogs-blog.php

	public static function get_blog_ids_for_user( $user_id = 0 ) {
		global $wpdb;

		$bp = buddypress();

		if ( !$user_id )
			$user_id = bp_displayed_user_id();

		return array_map( 'intval', $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM {$bp->blogs->table_name} WHERE user_id = %d", $user_id ) ) );

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.