bp_nouveau_ajax_messages_thread_read()
Description Description
Source Source
File: bp-templates/bp-nouveau/includes/messages/ajax.php
function bp_nouveau_ajax_messages_thread_read() { if ( empty( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'bp_nouveau_messages' ) ) { wp_send_json_error(); } if ( empty( $_POST['id'] ) || empty( $_POST['message_id'] ) ) { wp_send_json_error(); } $thread_id = (int) $_POST['id']; $message_id = (int) $_POST['message_id']; if ( ! messages_is_valid_thread( $thread_id ) || ( ! messages_check_thread_access( $thread_id ) && ! bp_current_user_can( 'bp_moderate' ) ) ) { wp_send_json_error(); } // Mark thread as read messages_mark_thread_read( $thread_id ); // Mark latest message as read if ( bp_is_active( 'notifications' ) ) { bp_notifications_mark_notifications_by_item_id( bp_loggedin_user_id(), (int) $message_id, buddypress()->messages->id, 'new_message' ); } wp_send_json_success(); }
Changelog Changelog
Version | Description |
---|---|
3.0.0 | Introduced. |