bp_blogs_is_blog_trackable( int $blog_id, int $user_id )

Check whether a given blog should be tracked by the Blogs component.


Description Description

If $user_id is provided, the developer can restrict site from being trackable only to particular users.


Parameters Parameters

$blog_id

(Required) ID of the blog being checked.

$user_id

(Optional) ID of the user for whom access is being checked.


Top ↑

Return Return

(bool) True if blog is trackable, otherwise false.


Top ↑

Source 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 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 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;
}

Top ↑

Changelog Changelog

Changelog
Version Description
1.7.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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