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-templates/bp-nouveau/includes/activity/template-tags.php

    r12970 r13114  
    44 *
    55 * @since 3.0.0
    6  * @version 8.1.0
     6 * @version 10.0.0
    77 */
    88
     
    145145
    146146    bp_nouveau_hook( $hook );
     147}
     148
     149/**
     150 * Output the `data-bp-activity-id` or `data-bp-activity-comment-id` attribute
     151 * according to the activity type.
     152 *
     153 * @since 10.0.0
     154 */
     155function bp_nouveau_activity_data_attribute_id() {
     156    $attribute  = 'data-bp-%1$s-id="%2$s"';
     157    $type       = 'activity';
     158    $id         = (int) bp_get_activity_id();
     159    $comment_id = (int) bp_get_activity_comment_id();
     160
     161    if ( 'activity_comment' === bp_get_activity_type() || $comment_id ) {
     162        $type = 'activity-comment';
     163
     164
     165        if ( $comment_id ) {
     166            $id = $comment_id;
     167        }
     168    }
     169
     170    printf( $attribute, $type, $id );
    147171}
    148172
Note: See TracChangeset for help on using the changeset viewer.