Skip to:
Content

BuddyPress.org

Ticket #7329: 7329.patch

File 7329.patch, 2.5 KB (added by slaFFik, 3 years ago)

The easiest but not elegant fix of this.

  • src/bp-activity/bp-activity-template.php

     
    22342234function bp_activity_comment_depth() {
    22352235        echo bp_activity_get_comment_depth();
    22362236}
     2237
    22372238        /**
    22382239         * Return the current activity comment depth.
    22392240         *
    22402241         * @since 2.0.0
    22412242         *
     2243         * @param null|BP_Activity_Activity $comment
     2244         *
    22422245         * @return int $depth Depth for the current activity comment.
    22432246         */
    2244         function bp_activity_get_comment_depth() {
     2247        function bp_activity_get_comment_depth( $comment = null ) {
    22452248                global $activities_template;
    22462249
     2250                $depth = 1;
     2251
     2252                if ( ! empty( $comment->depth ) ) {
     2253                        $depth = $comment->depth;
     2254                } elseif ( ! empty( $activities_template->activity->current_comment->depth ) ) {
     2255                        $depth = $activities_template->activity->current_comment->depth;
     2256                }
     2257
    22472258                /**
    22482259                 * Filters the comment depth of the current activity comment.
    22492260                 *
     
    22512262                 *
    22522263                 * @param int $depth Depth for the current activity comment.
    22532264                 */
    2254                 return apply_filters( 'bp_activity_get_comment_depth', $activities_template->activity->current_comment->depth );
     2265                return apply_filters( 'bp_activity_get_comment_depth', $depth );
    22552266        }
    22562267
    22572268/**
  • src/bp-blogs/bp-blogs-activity.php

     
    12991299        }
    13001300
    13011301        // Check comment depth and disable if depth is too large.
    1302         if ( isset( buddypress()->blogs->thread_depth[$comment->item_id] ) ){
    1303                 if ( bp_activity_get_comment_depth() > buddypress()->blogs->thread_depth[$comment->item_id] ) {
     1302        if ( isset( buddypress()->blogs->thread_depth[ $comment->item_id ] ) ) {
     1303                if ( bp_activity_get_comment_depth( $comment ) > buddypress()->blogs->thread_depth[ $comment->item_id ] ) {
    13041304                        $retval = false;
    13051305                }
    13061306        }
    13071307
    13081308        // Check if we should disable activity replies based on the parent activity.
    1309         if ( isset( buddypress()->blogs->allow_comments[$comment->item_id] ) ){
     1309        if ( isset( buddypress()->blogs->allow_comments[ $comment->item_id ] ) ) {
    13101310                // The blog post has closed off commenting, so we should disable all activity
    13111311                // comments under the parent 'new_blog_post' activity entry.
    1312                 if ( empty( buddypress()->blogs->allow_comments[$comment->item_id] ) ) {
     1312                if ( empty( buddypress()->blogs->allow_comments[ $comment->item_id ] ) ) {
    13131313                        $retval = false;
    13141314                }
    13151315        }