bp_blogs_total_blogs_for_user( int $user_id )
Get the total number of blogs being tracked by BP for a specific user.
Description
Parameters
- $user_id
-
(Required) ID of the user being queried. Default: on a user page, the displayed user. Otherwise, the logged-in user.
Return
(int) $count Total blog count for the user.
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; }
Changelog
Version | Description |
---|---|
BuddyPress 1.2.0 | Introduced. |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.