Changeset 10303 for trunk/src/bp-notifications/bp-notifications-actions.php
- Timestamp:
- 10/22/2015 06:02:55 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/bp-notifications-actions.php
r10138 r10303 23 23 function bp_notifications_action_mark_read() { 24 24 25 // Bail if not the unread screen 25 // Bail if not the unread screen. 26 26 if ( ! bp_is_notifications_component() || ! bp_is_current_action( 'unread' ) ) { 27 27 return false; 28 28 } 29 29 30 // Get the action 30 // Get the action. 31 31 $action = !empty( $_GET['action'] ) ? $_GET['action'] : ''; 32 32 $nonce = !empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : ''; 33 33 $id = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : ''; 34 34 35 // Bail if no action or no ID 35 // Bail if no action or no ID. 36 36 if ( ( 'read' !== $action ) || empty( $id ) || empty( $nonce ) ) { 37 37 return false; 38 38 } 39 39 40 // Check the nonce and mark the notification 40 // Check the nonce and mark the notification. 41 41 if ( bp_verify_nonce_request( 'bp_notification_mark_read_' . $id ) && bp_notifications_mark_notification( $id, false ) ) { 42 42 bp_core_add_message( __( 'Notification successfully marked read.', 'buddypress' ) ); … … 45 45 } 46 46 47 // Redirect 47 // Redirect. 48 48 bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/unread/' ); 49 49 } … … 59 59 function bp_notifications_action_mark_unread() { 60 60 61 // Bail if not the read screen 61 // Bail if not the read screen. 62 62 if ( ! bp_is_notifications_component() || ! bp_is_current_action( 'read' ) ) { 63 63 return false; 64 64 } 65 65 66 // Get the action 66 // Get the action. 67 67 $action = !empty( $_GET['action'] ) ? $_GET['action'] : ''; 68 68 $nonce = !empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : ''; 69 69 $id = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : ''; 70 70 71 // Bail if no action or no ID 71 // Bail if no action or no ID. 72 72 if ( ( 'unread' !== $action ) || empty( $id ) || empty( $nonce ) ) { 73 73 return false; 74 74 } 75 75 76 // Check the nonce and mark the notification 76 // Check the nonce and mark the notification. 77 77 if ( bp_verify_nonce_request( 'bp_notification_mark_unread_' . $id ) && bp_notifications_mark_notification( $id, true ) ) { 78 78 bp_core_add_message( __( 'Notification successfully marked unread.', 'buddypress' ) ); … … 81 81 } 82 82 83 // Redirect 83 // Redirect. 84 84 bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/read/' ); 85 85 } … … 95 95 function bp_notifications_action_delete() { 96 96 97 // Bail if not the read or unread screen 97 // Bail if not the read or unread screen. 98 98 if ( ! bp_is_notifications_component() || ! ( bp_is_current_action( 'read' ) || bp_is_current_action( 'unread' ) ) ) { 99 99 return false; 100 100 } 101 101 102 // Get the action 102 // Get the action. 103 103 $action = !empty( $_GET['action'] ) ? $_GET['action'] : ''; 104 104 $nonce = !empty( $_GET['_wpnonce'] ) ? $_GET['_wpnonce'] : ''; 105 105 $id = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : ''; 106 106 107 // Bail if no action or no ID 107 // Bail if no action or no ID. 108 108 if ( ( 'delete' !== $action ) || empty( $id ) || empty( $nonce ) ) { 109 109 return false; 110 110 } 111 111 112 // Check the nonce and delete the notification 112 // Check the nonce and delete the notification. 113 113 if ( bp_verify_nonce_request( 'bp_notification_delete_' . $id ) && bp_notifications_delete_notification( $id ) ) { 114 114 bp_core_add_message( __( 'Notification successfully deleted.', 'buddypress' ) ); … … 117 117 } 118 118 119 // Redirect 119 // Redirect. 120 120 bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/' ); 121 121 } … … 136 136 } 137 137 138 // Get the action 138 // Get the action. 139 139 $action = !empty( $_POST['notification_bulk_action'] ) ? $_POST['notification_bulk_action'] : ''; 140 140 $nonce = !empty( $_POST['notifications_bulk_nonce'] ) ? $_POST['notifications_bulk_nonce'] : ''; … … 178 178 } 179 179 180 // Redirect 180 // Redirect. 181 181 bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/' ); 182 182 }
Note: See TracChangeset
for help on using the changeset viewer.