[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Messages: Unread action handler. 4 * 5 * @package BuddyPress 6 * @subpackage MessageActions 7 * @since 3.0.0 8 */ 9 10 /** 11 * Handle marking a single message thread as unread. 12 * 13 * @since 2.2.0 14 * 15 * @return bool Returns false on failure. Otherwise redirects back to the 16 * message box URL. 17 */ 18 function bp_messages_action_mark_unread() { 19 20 if ( ! bp_is_messages_component() || bp_is_current_action( 'notices' ) || ! bp_is_action_variable( 'unread', 0 ) ) { 21 return false; 22 } 23 24 $action = ! empty( $_GET['action'] ) ? $_GET['action'] : ''; 25 $nonce = ! empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : ''; 26 $id = ! empty( $_GET['message_id'] ) ? intval( $_GET['message_id'] ) : ''; 27 28 // Bail if no action or no ID. 29 if ( 'unread' !== $action || empty( $id ) || empty( $nonce ) ) { 30 return false; 31 } 32 33 // Check the nonce. 34 if ( ! bp_verify_nonce_request( 'bp_message_thread_mark_unread_' . $id ) ) { 35 return false; 36 } 37 38 // Check access to the message and mark unread. 39 if ( messages_check_thread_access( $id ) || bp_current_user_can( 'bp_moderate' ) ) { 40 messages_mark_thread_unread( $id ); 41 bp_core_add_message( __( 'Message marked unread.', 'buddypress' ) ); 42 } else { 43 bp_core_add_message( __( 'There was a problem marking that message.', 'buddypress' ), 'error' ); 44 } 45 46 // Redirect back to the message box URL. 47 bp_core_redirect( bp_displayed_user_domain() . bp_get_messages_slug() . '/' . bp_current_action() ); 48 } 49 add_action( 'bp_actions', 'bp_messages_action_mark_unread' );
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Nov 21 01:00:57 2024 | Cross-referenced by PHPXref 0.7.1 |