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

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

Description

Parameters

$activity_type

(Optional) The activity type to check.

Default value: ''

$feature

(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

641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
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

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.