bp_blogs_is_blog_recordable

Check whether a given blog should be recorded in activity streams.

Description

bp_blogs_is_blog_recordable( (int) $blog_id, (int) $user_id = 0 ); 

If $user_id is provided, you can restrict site from being recordable only to particular users.

Parameters (2)

0. $blog_id (int)
ID of the blog being checked.
1. $user_id — Optional. (int)
ID of the user for whom access is being checked.

Usage

  1. if ( !function_exists( 'bp_blogs_is_blog_recordable' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-blogs/bp-blogs-functions.php'; 
  3.  
  4. // ID of the blog being checked. 
  5. $blog_id = -1; 
  6.  
  7. // Optional. ID of the user for whom access is being checked. 
  8. $user_id = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bp_blogs_is_blog_recordable($blog_id, $user_id); 
  12.  

Defined (1)

The function is defined in the following location(s).

/bp-blogs/bp-blogs-functions.php  
  1. function bp_blogs_is_blog_recordable( $blog_id, $user_id = 0 ) { 
  2.  
  3. /** 
  4. * Filters whether or not a blog is globally activity stream recordable. 
  5. * @since 1.7.0 
  6. * @param bool $value Whether or not recordable. Default true. 
  7. * @param int $blog_id Current blog ID. 
  8. */ 
  9. $recordable_globally = apply_filters( 'bp_blogs_is_blog_recordable', true, $blog_id ); 
  10.  
  11. if ( !empty( $user_id ) ) { 
  12. /** 
  13. * Filters whether or not a blog is globally activity stream recordable for user. 
  14. * @since 1.7.0 
  15. * @param bool $recordable_globally Whether or not recordable. 
  16. * @param int $blog_id Current blog ID. 
  17. * @param int $user_id Current user ID. 
  18. */ 
  19. $recordable_for_user = apply_filters( 'bp_blogs_is_blog_recordable_for_user', $recordable_globally, $blog_id, $user_id ); 
  20. } else { 
  21. $recordable_for_user = $recordable_globally; 
  22.  
  23. if ( !empty( $recordable_for_user ) ) { 
  24. return true; 
  25.  
  26. return $recordable_globally;