Skip to:
Content

BuddyPress.org

Changeset 7715


Ignore:
Timestamp:
12/23/2013 06:31:37 PM (13 years ago)
Author:
johnjamesjacoby
Message:

In bp_notifications_get_registered_components(), loop through active components looking for notification_callback and only include components that actually touch Notifications. See #5300. (trunk)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bp-notifications/bp-notifications-functions.php

    r7711 r7715  
    519519function bp_notifications_get_registered_components() {
    520520
     521        // Load BuddyPress
     522        $bp = buddypress();
     523
     524        // Setup return value
     525        $component_names = array();
     526
    521527        // Get the active components
    522         $active_components = buddypress()->active_components;
    523 
    524         // Get the component ID's from the active_components array
    525         $component_names   = array_keys( $active_components );
     528        $active_components = array_keys( $bp->active_components );
     529
     530        // Loop through components, look for callbacks, add to return value
     531        foreach ( $active_components as $component ) {
     532                if ( !empty( $bp->$component->notification_callback ) ) {
     533                        $component_names[] = $component;
     534                }
     535        }
    526536
    527537        // Return active components with registered notifications callbacks
    528         return apply_filters( 'bp_notifications_get_component_names', $component_names );
    529 }
     538        return apply_filters( 'bp_notifications_get_registered_components', $component_names, $active_components );
     539}
Note: See TracChangeset for help on using the changeset viewer.