Skip to:
Content

Ticket #6683: 6683.patch

File 6683.patch, 2.2 KB (added by imath, 2 years ago)
  • src/bp-activity/classes/class-bp-activity-activity.php

    diff --git src/bp-activity/classes/class-bp-activity-activity.php src/bp-activity/classes/class-bp-activity-activity.php
    index a4e82ba..7fad5ee 100644
    class BP_Activity_Activity { 
    537537                        'activities'     => null,
    538538                        'total'          => null,
    539539                        'has_more_items' => null,
     540                        'stream_mode'    => $r['display_comments'],
    540541                );
    541542
    542543                /**
  • src/bp-activity/classes/class-bp-activity-template.php

    diff --git src/bp-activity/classes/class-bp-activity-template.php src/bp-activity/classes/class-bp-activity-template.php
    index 864e551..740bcd7 100644
    class BP_Activity_Template { 
    248248
    249249                $this->has_more_items = $this->activities['has_more_items'];
    250250
     251                // Add the stream mode to inform how activity comments are displayed
     252                $this->stream_mode = $this->activities['stream_mode'];
     253
    251254                $this->activities = $this->activities['activities'];
    252255
    253256                if ( $max ) {
  • src/bp-members/bp-members-filters.php

    diff --git src/bp-members/bp-members-filters.php src/bp-members/bp-members-filters.php
    index 5575ebe..14d4e4a 100644
    function bp_members_edit_profile_url( $url, $user_id, $scheme = 'admin' ) { 
    127127        return apply_filters( 'bp_members_edit_profile_url', $profile_link, $url, $user_id, $scheme );
    128128}
    129129add_filter( 'edit_profile_url', 'bp_members_edit_profile_url', 10, 3 );
     130
     131
     132/**
     133 * Makes sure to avoid duplicate comments on the Just Me scope.
     134 *
     135 * @since  2.6.0
     136 *
     137 * @param  bool $can_comment True if the user can comment the activity. False otherwise.
     138 * @return bool              Unchanged if Activity stream mode is not 'stream'. False otherwise.
     139 */
     140function bp_members_comments_avoid_duplicates( $can_comment ) {
     141        global $activities_template;
     142
     143        if ( 'stream' === $activities_template->stream_mode && bp_is_current_action( 'just-me' ) ) {
     144                if ( ! empty( $activities_template->activity->children ) ) {
     145                        $activities_template->activity->children = array();
     146                }
     147
     148                $can_comment = false;
     149        }
     150
     151        return $can_comment;
     152}
     153add_filter( 'bp_activity_can_comment', 'bp_members_comments_avoid_duplicates' );