bp_activity_type_supports

Check if the *Post Type* activity supports a specific feature.

Description

bp_activity_type_supports( (string) $activity_type = '', (string) $feature = '' ); 

Parameters (2)

0. $activity_type — Optional. (string) => ''
The activity type to check.
1. $feature — Optional. (string) => ''
The feature to check. Currently supports: post-type-comment-tracking,, post-type-comment-reply & comment-reply.. See inline doc for more info.

Usage

  1. if ( !function_exists( 'bp_activity_type_supports' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-activity/bp-activity-functions.php'; 
  3.  
  4. // The activity type to check. 
  5. $activity_type = ''; 
  6. $feature = ''; 
  7.  
  8. // NOTICE! Understand what this does before running. 
  9. $result = bp_activity_type_supports($activity_type, $feature); 
  10.  

Defined (1)

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

/bp-activity/bp-activity-functions.php  
  1. function bp_activity_type_supports( $activity_type = '', $feature = '' ) { 
  2. $retval = false; 
  3.  
  4. $bp =buddypress); 
  5.  
  6. switch ( $feature ) { 
  7. /** 
  8. * Does this activity type support comment tracking? 
  9. * eg. 'new_blog_post' and 'new_blog_comment' will both return true. 
  10. */ 
  11. case 'post-type-comment-tracking' : 
  12. // Set the activity track global if not set yet 
  13. if ( empty( $bp->activity->track ) ) { 
  14. $bp->activity->track = bp_activity_get_post_types_tracking_args(); 
  15.  
  16. if ( ! empty( $bp->activity->track[ $activity_type ]->comments_tracking ) ) { 
  17. $retval = true; 
  18. break; 
  19.  
  20. /** 
  21. * Is this a parent activity type that support post comments? 
  22. * eg. 'new_blog_post' will return true; 'new_blog_comment' will return false. 
  23. */ 
  24. case 'post-type-comment-reply' : 
  25. // Set the activity track global if not set yet. 
  26. if ( empty( $bp->activity->track ) ) { 
  27. $bp->activity->track = bp_activity_get_post_types_tracking_args(); 
  28.  
  29. if ( ! empty( $bp->activity->track[ $activity_type ]->comments_tracking ) && ! empty( $bp->activity->track[ $activity_type ]->comment_action_id ) ) { 
  30. $retval = true; 
  31. break; 
  32.  
  33. /** 
  34. * Does this activity type support comment & reply? 
  35. */ 
  36. case 'comment-reply' : 
  37. // Set the activity track global if not set yet. 
  38. if ( empty( $bp->activity->track ) ) { 
  39. $bp->activity->track = bp_activity_get_post_types_tracking_args(); 
  40.  
  41. // Post Type activities 
  42. if ( ! empty( $bp->activity->track[ $activity_type ] ) ) { 
  43. if ( isset( $bp->activity->track[ $activity_type ]->activity_comment ) ) { 
  44. $retval = $bp->activity->track[ $activity_type ]->activity_comment; 
  45.  
  46. // Eventually override with comment synchronization feature. 
  47. if ( isset( $bp->activity->track[ $activity_type ]->comments_tracking ) ) { 
  48. $retval = $bp->activity->track[ $activity_type ]->comments_tracking && ! bp_disable_blogforum_comments(); 
  49.  
  50. // Retired Forums component 
  51. } elseif ( 'new_forum_topic' === $activity_type || 'new_forum_post' === $activity_type ) { 
  52.  
  53. // By Default, all other activity types are supporting comments. 
  54. } else { 
  55. $retval = true; 
  56. break; 
  57.  
  58. return $retval;