Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/25/2009 09:25:19 PM (15 years ago)
Author:
apeatling
Message:

Activity comment deletion support.

File:
1 edited

Legend:

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

    r2126 r2130  
    484484add_action( 'wp_ajax_post_update', 'bp_dtheme_post_update' );
    485485
    486 
    487486function bp_dtheme_new_activity_comment() {
    488487    global $bp;
     
    547546add_action( 'wp_ajax_new_activity_comment', 'bp_dtheme_new_activity_comment' );
    548547
     548function bp_dtheme_delete_activity_comment() {
     549    /* Check the nonce */
     550    check_admin_referer( 'delete_activity_comment' );
     551
     552    if ( !is_user_logged_in() ) {
     553        echo '-1';
     554        return false;
     555    }
     556
     557    if ( empty( $_POST['comment_id'] ) || !is_numeric( $_POST['comment_id'] ) || !bp_activity_delete_by_activity_id( $_POST['comment_id'] ) ) {
     558        echo '-1<div class="error"><p>' . __( 'There was a problem deleting that comment. Please try again.', 'buddypress' ) . '</p></div>';
     559        return false;
     560    }
     561
     562    return true;
     563}
     564add_action( 'wp_ajax_delete_activity_comment', 'bp_dtheme_delete_activity_comment' );
     565
    549566function bp_dtheme_ajax_show_form() {
    550567    locate_template( array( 'status/post-form.php' ), true );
Note: See TracChangeset for help on using the changeset viewer.