BP_REST_Messages_Actions_Endpoint::rest_hide_thread( integer $thread_id, boolen $value )
Hide unhide message thread based on the logged in user.
Description
Parameters
- $thread_id
-
(Required) ID of the Messages Thread.
- $value
-
(Required) Action value.
Return
(bool|void)
Source
File: bp-messages/classes/class-bp-rest-messages-actions-endpoint.php
protected function rest_hide_thread( $thread_id, $value ) { global $bp, $wpdb; if ( empty( $value ) ) { // phpcs:ignore $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_hidden = %d WHERE thread_id = %d AND user_id = %d", 0, (int) $thread_id, bp_loggedin_user_id() ) ); return true; } elseif ( ! empty( $value ) ) { // phpcs:ignore $wpdb->query( $wpdb->prepare( "UPDATE {$bp->messages->table_name_recipients} SET is_hidden = %d WHERE thread_id = %d AND user_id = %d", 1, (int) $thread_id, bp_loggedin_user_id() ) ); return true; } return false; }
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.