Changeset 13036
- Timestamp:
- 08/10/2021 04:55:25 PM (3 years ago)
- Location:
- trunk/src/bp-templates/bp-nouveau/includes/messages
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-templates/bp-nouveau/includes/messages/functions.php
r12908 r13036 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 10.0.0 7 7 */ 8 8 … … 191 191 192 192 /** 193 * @since 3.0.0 193 * Prepend a notification about the active Sitewide notice. 194 * 195 * @since 3.0.0 196 * 197 * @param false|array $notifications False if there are no items, an array of notification items otherwise. 198 * @param int $user_id The user ID. 199 * @return false|array False if there are no items, an array of notification items otherwise. 194 200 */ 195 201 function bp_nouveau_add_notice_notification_for_user( $notifications, $user_id ) { … … 212 218 } 213 219 214 $notice_notification = new stdClass; 215 $notice_notification->id = 0; 216 $notice_notification->user_id = $user_id; 217 $notice_notification->item_id = $notice->id; 218 $notice_notification->secondary_item_id = ''; 219 $notice_notification->component_name = 'messages'; 220 $notice_notification->component_action = 'new_notice'; 221 $notice_notification->date_notified = $notice->date_sent; 222 $notice_notification->is_new = '1'; 223 224 return array_merge( $notifications, array( $notice_notification ) ); 225 } 226 227 /** 228 * @since 3.0.0 220 $notice_notification = (object) array( 221 'id' => 0, 222 'user_id' => $user_id, 223 'item_id' => $notice->id, 224 'secondary_item_id' => 0, 225 'component_name' => 'messages', 226 'component_action' => 'new_notice', 227 'date_notified' => $notice->date_sent, 228 'is_new' => 1, 229 'total_count' => 1, 230 'content' => __( 'New sitewide notice', 'buddypress' ), 231 'href' => bp_loggedin_user_domain(), 232 ); 233 234 if ( ! is_array( $notifications ) ) { 235 $notifications = array( $notice_notification ); 236 } else { 237 array_unshift( $notifications, $notice_notification ); 238 } 239 240 return $notifications; 241 } 242 243 /** 244 * Format the notice notifications. 245 * 246 * @since 3.0.0 247 * @deprecated 10.0.0 248 * 249 * @param array $array. 229 250 */ 230 251 function bp_nouveau_format_notice_notification_for_user( $array ) { 231 if ( ! empty( $array['text'] ) || ! doing_action( 'admin_bar_menu' ) ) { 232 return $array; 233 } 234 235 return array( 236 'text' => __( 'New sitewide notice', 'buddypress' ), 237 'link' => bp_loggedin_user_domain(), 238 ); 252 _deprecated_function( __FUNCTION__, '10.0.0' ); 239 253 } 240 254 -
trunk/src/bp-templates/bp-nouveau/includes/messages/loader.php
r12192 r13036 4 4 * 5 5 * @since 3.0.0 6 * @version 3.0.06 * @version 10.0.0 7 7 */ 8 8 … … 89 89 */ 90 90 protected function setup_filters() { 91 // Enqueue specific styles 91 // Enqueue specific styles. 92 92 add_filter( 'bp_nouveau_enqueue_styles', 'bp_nouveau_messages_enqueue_styles', 10, 1 ); 93 93 94 // Register messages scripts 94 // Register messages scripts. 95 95 add_filter( 'bp_nouveau_register_scripts', 'bp_nouveau_messages_register_scripts', 10, 1 ); 96 96 97 // Localize Scripts 97 // Localize Scripts. 98 98 add_filter( 'bp_core_get_js_strings', 'bp_nouveau_messages_localize_scripts', 10, 1 ); 99 99 100 // Notices 101 add_filter( 'bp_messages_single_new_message_notification', 'bp_nouveau_format_notice_notification_for_user', 10, 1 ); 102 add_filter( 'bp_notifications_get_all_notifications_for_user', 'bp_nouveau_add_notice_notification_for_user', 10, 2 ); 100 // Notices. 101 add_filter( 'bp_core_get_notifications_for_user', 'bp_nouveau_add_notice_notification_for_user', 10, 2 ); 103 102 104 // Messages 103 // Messages. 105 104 add_filter( 'bp_messages_admin_nav', 'bp_nouveau_messages_adjust_admin_nav', 10, 1 ); 106 105 }
Note: See TracChangeset
for help on using the changeset viewer.