Ticket #6663: 6663.01.patch
File 6663.01.patch, 3.5 KB (added by , 9 years ago) |
---|
-
src/bp-notifications/bp-notifications-functions.php
diff --git src/bp-notifications/bp-notifications-functions.php src/bp-notifications/bp-notifications-functions.php index 33796ba..7dc3242 100644
function bp_notifications_get_notifications_for_user( $user_id, $format = 'strin 200 200 // Calculate a renderable output for each notification type 201 201 foreach ( $grouped_notifications as $component_name => $action_arrays ) { 202 202 203 // The xprofile component is keyed with 'profile' in the $bp array. 204 // @TODO: This seems like a hack. 205 if ( $component_name == 'xprofile' ) { 206 $component_name = 'profile'; 207 } 208 203 209 // Skip if group is empty 204 210 if ( empty( $action_arrays ) ) { 205 211 continue; … … function bp_notifications_get_registered_components() { 611 617 if ( !empty( $bp->$component->notification_callback ) ) { 612 618 $component_names[] = $component; 613 619 } 620 // The profile component's name isn't the same everywhere. 621 // @TODO: This seems like a hack. 622 if ( $component == 'xprofile' && ! empty( $bp->profile->notification_callback ) ) { 623 $component_names[] = $component; 624 } 614 625 } 615 626 616 627 /** -
src/bp-xprofile/bp-xprofile-loader.php
diff --git src/bp-xprofile/bp-xprofile-loader.php src/bp-xprofile/bp-xprofile-loader.php index 7bd8123..8fdbdd5 100644
class BP_XProfile_Component extends BP_Component { 67 67 'settings', 68 68 'template', 69 69 'functions', 70 'notifications', 70 71 ); 71 72 72 73 if ( is_admin() ) { -
new file src/bp-xprofile/bp-xprofile-notifications.php
diff --git src/bp-xprofile/bp-xprofile-notifications.php src/bp-xprofile/bp-xprofile-notifications.php new file mode 100644 index 0000000..06e9fc7
- + 1 <?php 2 /** Notifications *************************************************************/ 3 4 /** 5 * Format notifications for the Xprofile component. 6 * 7 * @since 2.4.0 8 * 9 * @param string $action The kind of notification being rendered. 10 * @param int $item_id The primary item ID. 11 * @param int $secondary_item_id The secondary item ID. 12 * @param int $total_items The total number of messaging-related notifications 13 * waiting for the user. 14 * @param string $format 'string' for BuddyBar-compatible notifications; 'array' 15 * for WP Toolbar. Default: 'string'. 16 * 17 * @return string 18 */ 19 function xprofile_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { 20 switch ( $action ) { 21 default: 22 23 /** 24 * Filters plugin-added xprofile-related custom component_actions. 25 * 26 * @since 2.4.0 27 * 28 * @param string $notification Null value. 29 * @param int $item_id The primary item ID. 30 * @param int $secondary_item_id The secondary item ID. 31 * @param int $total_items The total number of messaging-related notifications 32 * waiting for the user. 33 * @param string $format 'string' for BuddyBar-compatible notifications; 34 * 'array' for WP Toolbar. 35 */ 36 $custom_action_notification = apply_filters( 'bp_xprofile_' . $action . '_notification', null, $item_id, $secondary_item_id, $total_items, $format ); 37 38 if ( ! is_null( $custom_action_notification ) ) { 39 return $custom_action_notification; 40 } 41 42 break; 43 } 44 45 return false; 46 } 47 No newline at end of file