bp_activity_type_supports( string $activity_type = '', string $feature = '' )
Check if the *Post Type* activity supports a specific feature.
Description
Parameters
- $activity_type
-
(string) (Optional) The activity type to check.
Default value: ''
- $feature
-
(string) (Optional) The feature to check. Currently supports: 'post-type-comment-tracking', 'post-type-comment-reply' & 'comment-reply'. See inline doc for more info.
Default value: ''
Return
(bool)
Source
File: bp-activity/bp-activity-functions.php
function bp_activity_type_supports( $activity_type = '', $feature = '' ) { $retval = false; $bp = buddypress(); switch ( $feature ) { /** * Does this activity type support comment tracking? * * eg. 'new_blog_post' and 'new_blog_comment' will both return true. */ case 'post-type-comment-tracking' : // Set the activity track global if not set yet if ( empty( $bp->activity->track ) ) { $bp->activity->track = bp_activity_get_post_types_tracking_args(); } if ( ! empty( $bp->activity->track[ $activity_type ]->comments_tracking ) ) { $retval = true; } break; /** * Is this a parent activity type that support post comments? * * eg. 'new_blog_post' will return true; 'new_blog_comment' will return false. */ case 'post-type-comment-reply' : // Set the activity track global if not set yet. if ( empty( $bp->activity->track ) ) { $bp->activity->track = bp_activity_get_post_types_tracking_args(); } if ( ! empty( $bp->activity->track[ $activity_type ]->comments_tracking ) && ! empty( $bp->activity->track[ $activity_type ]->comment_action_id ) ) { $retval = true; } break; /** * Does this activity type support comment & reply? */ case 'comment-reply' : // Set the activity track global if not set yet. if ( empty( $bp->activity->track ) ) { $bp->activity->track = bp_activity_get_post_types_tracking_args(); } // Post Type activities if ( ! empty( $bp->activity->track[ $activity_type ] ) ) { if ( isset( $bp->activity->track[ $activity_type ]->activity_comment ) ) { $retval = $bp->activity->track[ $activity_type ]->activity_comment; } // Eventually override with comment synchronization feature. if ( isset( $bp->activity->track[ $activity_type ]->comments_tracking ) ) { $retval = $bp->activity->track[ $activity_type ]->comments_tracking && ! bp_disable_blogforum_comments(); } // Retired Forums component } elseif ( 'new_forum_topic' === $activity_type || 'new_forum_post' === $activity_type ) { $retval = ! bp_disable_blogforum_comments(); // By Default, all other activity types are supporting comments. } else { $retval = true; } break; } return $retval; }
Changelog
Version | Description |
---|---|
BuddyPress 2.5.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.