bp_nouveau_ajax_media_album_delete()
Delete album
Description
Source
File: bp-templates/bp-nouveau/includes/media/ajax.php
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | function bp_nouveau_ajax_media_album_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 ); } if ( empty ( $_POST [ '_wpnonce' ] ) ) { wp_send_json_error( $response ); } // Use default nonce $nonce = $_POST [ '_wpnonce' ]; $check = 'bp_nouveau_media' ; // Nonce check! if ( empty ( $nonce ) || ! wp_verify_nonce( $nonce , $check ) ) { wp_send_json_error( $response ); } if ( empty ( $_POST [ 'album_id' ] ) ) { $response [ 'feedback' ] = sprintf( '<div class="bp-feedback error"><span class="bp-icon" aria-hidden="true"></span><p>%s</p></div>' , esc_html__( 'Please provide ID of album to delete.' , 'buddyboss' ) ); wp_send_json_error( $response ); } // delete album $album_id = bp_album_delete( $_POST [ 'album_id' ] ); if ( ! $album_id ) { wp_send_json_error( $response ); } $group_id = ! empty ( $_POST [ 'group_id' ] ) ? (int) $_POST [ 'group_id' ] : false; if ( ! empty ( $group_id ) && bp_is_active( 'groups' ) ) { $group_link = bp_get_group_permalink( groups_get_group( $_POST [ 'group_id' ] ) ); $redirect_url = trailingslashit( $group_link . '/albums/' ); } else { $redirect_url = trailingslashit( bp_displayed_user_domain() . bp_get_media_slug() . '/albums/' ); } wp_send_json_success( array ( 'redirect_url' => $redirect_url , ) ); } |
Changelog
Version | Description |
---|---|
BuddyBoss 1.0.0 | Introduced. |
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.