Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
09/24/2021 01:54:39 AM (4 years ago)
Author:
imath
Message:

Make sure deleting an activity comment also deletes its children

This commit also takes care of redirecting the user to the activity single view when clicking on the comment button and there is no comment form available for the corresponding activity. This case can happen on a single member's activity stream when the main activity is an activity comment.

Props yesbutmaybeno

Fixes #8415

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-activity/bp-activity-template.php

    r13108 r13114  
    26782678        if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
    26792679            $class = 'delete-activity-single';
     2680        } elseif ( 'activity_comment' === bp_get_activity_type() ) {
     2681            $class = 'acomment-delete';
    26802682        }
    26812683
     
    27142716        global $activities_template;
    27152717
    2716         $url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activities_template->activity->id );
     2718        $activity_id = 0;
     2719        if ( isset( $activities_template->activity->id ) ) {
     2720            $activity_id = (int) $activities_template->activity->id;
     2721        }
     2722
     2723        $url = trailingslashit( bp_get_root_domain() . '/' . bp_get_activity_root_slug() . '/delete/' . $activity_id );
    27172724
    27182725        // Determine if we're on a single activity page, and customize accordingly.
    27192726        if ( bp_is_activity_component() && is_numeric( bp_current_action() ) ) {
    27202727            $url = add_query_arg( array( 'redirect_to' => wp_get_referer() ), $url );
     2728        } elseif ( 'activity_comment' === bp_get_activity_type() ) {
     2729            $url = add_query_arg( 'cid', $activity_id, $url );
    27212730        }
    27222731
Note: See TracChangeset for help on using the changeset viewer.