Changeset 4622 for trunk/bp-messages/bp-messages-functions.php
- Timestamp:
- 07/06/2011 08:02:44 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-messages/bp-messages-functions.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-messages/bp-messages-functions.php
r4605 r4622 212 212 */ 213 213 214 function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items ) { 214 /** 215 * Format the BuddyBar/admin bar notifications for the Messages component 216 * 217 * @package BuddyPress 218 * 219 * @param str $action The kind of notification being rendered 220 * @param int $item_id The primary item id 221 * @param int $secondary_item_id The secondary item id 222 * @param int $total_items The total number of messaging-related notifications waiting for the user 223 * @param str $format 'string' for BuddyBar-compatible notifications; 'array' for WP Admin Bar 224 */ 225 function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 215 226 global $bp; 216 227 217 228 if ( 'new_message' == $action ) { 218 if ( (int)$total_items > 1 ) 219 return apply_filters( 'bp_messages_multiple_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="' . __( 'Inbox', 'buddypress' ) . '">' . sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items ) . '</a>', $total_items ); 220 else 221 return apply_filters( 'bp_messages_single_new_message_notification', '<a href="' . $bp->loggedin_user->domain . $bp->messages->slug . '/inbox" title="' . __( 'Inbox', 'buddypress' ) . '">' . sprintf( __('You have %d new message', 'buddypress' ), (int)$total_items ) . '</a>', $total_items ); 229 $link = bp_loggedin_user_domain() . bp_get_messages_slug() . '/inbox'; 230 $title = __( 'Inbox', 'buddypress' ); 231 232 if ( (int)$total_items > 1 ) { 233 $text = sprintf( __('You have %d new messages', 'buddypress' ), (int)$total_items ); 234 $filter = 'bp_messages_multiple_new_message_notification'; 235 } else { 236 $text = sprintf( __('You have %d new message', 'buddypress' ), (int)$total_items ); 237 $filter = 'bp_messages_single_new_message_notification'; 238 } 239 } 240 241 if ( 'string' == $format ) { 242 $return = apply_filters( $filter, '<a href="' . $link . '" title="' . $title . '">' . $text . '</a>', (int)$total_items, $text, $link ); 243 } else { 244 $return = apply_filters( $filter, array( 245 'text' => $text, 246 'link' => $at_mention_link 247 ), $at_mention_link, (int)$total_items, $text, $link ); 222 248 } 223 249 224 250 do_action( 'messages_format_notifications', $action, $item_id, $secondary_item_id, $total_items ); 225 251 226 return false;252 return $return; 227 253 } 228 254 ?>
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)