bp_legacy_theme_delete_activity_comment
Deletes an Activity comment received via a POST request.
Description
bp_legacy_theme_delete_activity_comment();
Usage
if ( !function_exists( 'bp_legacy_theme_delete_activity_comment' ) ) { require_once ABSPATH . PLUGINDIR . 'buddypress/bp-templates/bp-legacy/buddypress-functions.php'; } // NOTICE! Understand what this does before running. $result = bp_legacy_theme_delete_activity_comment();
Defined (1)
The function is defined in the following location(s).
- /bp-templates/bp-legacy/buddypress-functions.php
- function bp_legacy_theme_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 ( empty( $_POST['id'] ) || ! is_numeric( $_POST['id'] ) ) {
- exit( '-1' );
- }
- 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' );
- /** This action is documented in bp-activity/bp-activity-actions.php */
- 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 bp-ajax-message"><p>' . __( 'There was a problem when deleting. Please try again.', buddypress ) . '</p></div>' );
- /** This action is documented in bp-activity/bp-activity-actions.php */
- do_action( 'bp_activity_action_delete_activity', $_POST['id'], $comment->user_id );
- exit;
- }