Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
02/10/2010 03:15:48 PM (15 years ago)
Author:
apeatling
Message:

Fixes #1862 - remove all child comments when deleting a comment.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-themes/bp-default/_inc/ajax.php

    r2606 r2644  
    226226    return true;
    227227}
    228 add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity' );
    229228add_action( 'wp_ajax_delete_activity', 'bp_dtheme_delete_activity' );
     229
     230function bp_dtheme_delete_activity_comment() {
     231    global $bp;
     232
     233    /* Check the nonce */
     234    check_admin_referer( 'bp_activity_delete_link' );
     235
     236    if ( !is_user_logged_in() ) {
     237        echo '-1';
     238        return false;
     239    }
     240
     241    $comment = new BP_Activity_Activity( $_POST['id'] );
     242
     243    /* Check access */
     244    if ( !is_site_admin() && $comment->user_id != $bp->loggedin_user->id )
     245        return false;
     246
     247    if ( empty( $_POST['id'] ) || !is_numeric( $_POST['id'] ) || !bp_activity_delete_comment( $comment->item_id, $comment->id ) ) {
     248        echo '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>';
     249        return false;
     250    }
     251
     252    return true;
     253}
     254add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' );
    230255
    231256function bp_dtheme_mark_activity_favorite() {
Note: See TracChangeset for help on using the changeset viewer.