bp_nouveau_ajax_document_activity_delete()
Description
Source
File: bp-templates/bp-nouveau/includes/document/ajax.php
1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 | function bp_nouveau_ajax_document_activity_delete() { $response = array ( 'feedback' => sprintf( '<div class="bp-feedback error bp-ajax-message"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>' , esc_html__( 'There was a problem performing this action. Please try again.' , 'buddyboss' ) ), ); // Bail if not a POST action. if ( ! bp_is_post_request() ) { wp_send_json_error( $response ); } $id = ! empty ( $_POST [ 'id' ] ) ? (int) $_POST [ 'id' ] : 0; $attachment_id = ! empty ( $_POST [ 'attachment_id' ] ) ? (int) $_POST [ 'attachment_id' ] : 0; $type = ! empty ( $_POST [ 'type' ] ) ? $_POST [ 'type' ] : '' ; $activity_id = ! empty ( $_POST [ 'activity_id' ] ) ? $_POST [ 'activity_id' ] : 0; if ( '' === $type ) { wp_send_json_error( $response ); } if ( bp_document_user_can_delete( $id ) ) { $args = array ( 'id' => $id , 'attachment_id' => $attachment_id , ); bp_document_delete( $args ); } $delete_box = false; // Get activity object. $activity = new BP_Activity_Activity( $activity_id ); if ( empty ( $activity ->id ) ) { $delete_box = true; } wp_send_json_success( array ( 'message' => 'success' , 'delete_activity' => $delete_box , ) ); } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.