bp_dtheme_delete_activity_comment()
Deletes an Activity comment received via a POST request
Description Description
Return Return
(mixed) String on error, void on success
Source Source
File: bp-themes/bp-default/_inc/ajax.php
function bp_dtheme_delete_activity_comment() {
// Bail if not a POST action
if ( 'POST' !== strtoupper( $_SERVER['REQUEST_METHOD'] ) )
return;
// Check the nonce
check_admin_referer( 'bp_activity_delete_link' );
if ( ! is_user_logged_in() )
exit( '-1' );
$comment = new BP_Activity_Activity( $_POST['id'] );
// Check access
if ( ! bp_current_user_can( 'bp_moderate' ) && $comment->user_id != bp_loggedin_user_id() )
exit( '-1' );
if ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) )
exit( '-1' );
// Call the action before the delete so plugins can still fetch information about it
do_action( 'bp_activity_before_action_delete_activity', $_POST['id'], $comment->user_id );
if ( ! bp_activity_delete_comment( $comment->item_id, $comment->id ) )
exit( '-1<div id="message" class="error"><p>' . __( 'There was a problem when deleting. Please try again.', 'buddypress' ) . '</p></div>' );
do_action( 'bp_activity_action_delete_activity', $_POST['id'], $comment->user_id );
exit;
}
Changelog Changelog
| Version | Description |
|---|---|
| BuddyPress (1.2) | Introduced. |