bp_blogs_total_blogs_for_user( int $user_id )

Get the total number of blogs being tracked by BP for a specific user.


Parameters Parameters

$user_id

(int) (Required) ID of the user being queried. Default: on a user page, the displayed user. Otherwise, the logged-in user.


Top ↑

Return Return

(int) $count Total blog count for the user.


Source Source

File: bp-blogs/bp-blogs-functions.php

function bp_blogs_total_blogs_for_user( $user_id = 0 ) {
	if ( empty( $user_id ) ) {
		$user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
	}

	// No user ID? do not attempt to look at cache.
	if ( empty( $user_id ) ) {
		return 0;
	}

	$count = wp_cache_get( 'bp_total_blogs_for_user_' . $user_id, 'bp' );
	if ( false === $count ) {
		$count = BP_Blogs_Blog::total_blog_count_for_user( $user_id );
		wp_cache_set( 'bp_total_blogs_for_user_' . $user_id, $count, 'bp' );
	}

	return $count;
}


Top ↑

Changelog Changelog

Changelog
Version Description
1.2.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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