bp_blogs_is_blog_trackable( int $blog_id, int $user_id )
Check whether a given blog should be tracked by the Blogs component.
Description
If $user_id is provided, the developer can restrict site from being trackable only to particular users.
Parameters
- $blog_id
-
(Required) ID of the blog being checked.
- $user_id
-
(Optional) ID of the user for whom access is being checked.
Return
(bool) True if blog is trackable, otherwise false.
Source
File: bp-blogs/bp-blogs-functions.php
function bp_blogs_is_blog_trackable( $blog_id, $user_id = 0 ) {
/**
* Filters whether or not a blog is globally trackable.
*
* @since BuddyPress 1.7.0
*
* @param bool $value Whether or not trackable.
* @param int $blog_id Current blog ID.
*/
$trackable_globally = apply_filters( 'bp_blogs_is_blog_trackable', bp_blogs_is_blog_recordable( $blog_id, $user_id ), $blog_id );
if ( !empty( $user_id ) ) {
/**
* Filters whether or not a blog is globally trackable for user.
*
* @since BuddyPress 1.7.0
*
* @param bool $value Whether or not trackable.
* @param int $blog_id Current blog ID.
* @param int $user_id Current user ID.
*/
$trackable_for_user = apply_filters( 'bp_blogs_is_blog_trackable_for_user', $trackable_globally, $blog_id, $user_id );
} else {
$trackable_for_user = $trackable_globally;
}
if ( !empty( $trackable_for_user ) ) {
return $trackable_for_user;
}
return $trackable_globally;
}
Changelog
| Version | Description |
|---|---|
| BuddyPress 1.7.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.