BP_REST_Reply_Actions_Endpoint::rest_update_reply_trash( int $reply_id, boolean $value )
Move reply in trash and untrash.
Description
Parameters
- $reply_id
-
(Required) Reply ID.
- $value
-
(Required) Action value.
Return
(bool|mixed)
Source
File: bp-forums/classes/class-bp-rest-reply-actions-endpoint.php
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 | protected function rest_update_reply_trash( $reply_id , $value ) { // What is the user doing here? if ( ! current_user_can( 'moderate' , $reply_id ) ) { return new WP_Error( 'bp_rest_authorization_required' , __( 'You do not have permission to do this.' , 'buddyboss' ), array ( 'status' => 404, ) ); } $post_status = get_post_status( $reply_id ); if ( 'trash' === $post_status && empty ( $value ) ) { $status = wp_untrash_post( $reply_id ); } elseif ( 'trash' !== $post_status && ! empty ( $value ) ) { $status = wp_trash_post( $reply_id ); } return ( ! empty ( $status ) && ! is_wp_error( $status ) ? true : $status ); } |
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.