Ticket #8547: 8547.patch
File 8547.patch, 4.3 KB (added by , 3 years ago) |
---|
-
src/bp-templates/bp-nouveau/includes/messages/functions.php
diff --git src/bp-templates/bp-nouveau/includes/messages/functions.php src/bp-templates/bp-nouveau/includes/messages/functions.php index 1ec7d6e26..a6c7a3064 100644
3 3 * Messages functions 4 4 * 5 5 * @since 3.0.0 6 * @version 3.1.06 * @version 10.0.0 7 7 */ 8 8 9 9 // Exit if accessed directly. … … function bp_nouveau_messages_adjust_admin_nav( $admin_nav ) { 190 190 } 191 191 192 192 /** 193 * Prepend a notification about the active Sitewide notice. 194 * 193 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 ) { 196 202 if ( ! bp_is_active( 'messages' ) || ! doing_action( 'admin_bar_menu' ) ) { … … function bp_nouveau_add_notice_notification_for_user( $notifications, $user_id ) 211 217 return $notifications; 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 ) ); 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; 225 241 } 226 242 227 243 /** 244 * Format the notice notifications. 245 * 228 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 241 255 /** -
src/bp-templates/bp-nouveau/includes/messages/loader.php
diff --git src/bp-templates/bp-nouveau/includes/messages/loader.php src/bp-templates/bp-nouveau/includes/messages/loader.php index 10cdb84b0..a7dad9f05 100644
3 3 * BP Nouveau Messages 4 4 * 5 5 * @since 3.0.0 6 * @version 3.0.06 * @version 10.0.0 7 7 */ 8 8 9 9 // Exit if accessed directly. … … class BP_Nouveau_Messages { 88 88 * @since 3.0.0 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 } 107 106 }