[ Index ] |
PHP Cross Reference of BuddyPress |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Notifications: User's "Notifications > Read" screen handler. 4 * 5 * @package BuddyPress 6 * @subpackage NotificationsScreens 7 * @since 3.0.0 8 */ 9 10 /** 11 * Catch and route the 'read' notifications screen. 12 * 13 * @since 1.9.0 14 */ 15 function bp_notifications_screen_read() { 16 17 /** 18 * Fires right before the loading of the notifications read screen template file. 19 * 20 * @since 1.9.0 21 */ 22 do_action( 'bp_notifications_screen_read' ); 23 24 /** 25 * Filters the template to load for the notifications read screen. 26 * 27 * @since 1.9.0 28 * 29 * @param string $template Path to the notifications read template to load. 30 */ 31 bp_core_load_template( apply_filters( 'bp_notifications_template_read', 'members/single/home' ) ); 32 } 33 34 /** 35 * Handle marking single notifications as unread. 36 * 37 * @since 1.9.0 38 * 39 * @return bool 40 */ 41 function bp_notifications_action_mark_unread() { 42 43 // Bail if not the read screen. 44 if ( ! bp_is_notifications_component() || ! bp_is_current_action( 'read' ) ) { 45 return false; 46 } 47 48 // Get the action. 49 $action = !empty( $_GET['action'] ) ? $_GET['action'] : ''; 50 $nonce = !empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : ''; 51 $id = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : ''; 52 53 // Bail if no action or no ID. 54 if ( ( 'unread' !== $action ) || empty( $id ) || empty( $nonce ) ) { 55 return false; 56 } 57 58 // Check the nonce and mark the notification. 59 if ( bp_verify_nonce_request( 'bp_notification_mark_unread_' . $id ) && bp_notifications_mark_notification( $id, true ) ) { 60 bp_core_add_message( __( 'Notification successfully marked unread.', 'buddypress' ) ); 61 } else { 62 bp_core_add_message( __( 'There was a problem marking that notification.', 'buddypress' ), 'error' ); 63 } 64 65 // Redirect. 66 bp_core_redirect( bp_get_notifications_read_permalink( bp_displayed_user_id() ) ); 67 } 68 add_action( 'bp_actions', 'bp_notifications_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 |