user_id ); // Delete the activity item and provide user feedback. if ( bp_activity_delete( array( 'id' => $activity_id, 'user_id' => $activity->user_id ) ) ) bp_core_add_message( __( 'Activity deleted successfully', 'buddypress' ) ); else bp_core_add_message( __( 'There was an error when deleting that activity', 'buddypress' ), 'error' ); /** * Fires after the deletion so plugins can act afterwards based on the activity. * * @since 1.1.0 * * @param int $activity_id The activity ID. * @param int $user_id The user associated with the activity. */ do_action( 'bp_activity_action_delete_activity', $activity_id, $activity->user_id ); // Check for the redirect query arg, otherwise let WP handle things. if ( !empty( $_GET['redirect_to'] ) ) bp_core_redirect( esc_url( $_GET['redirect_to'] ) ); else bp_core_redirect( wp_get_referer() ); } add_action( 'bp_actions', 'bp_activity_action_delete_activity' );