Skip to:
Content

BuddyPress.org

Changeset 7712


Ignore:
Timestamp:
12/23/2013 05:48:19 PM (12 years ago)
Author:
johnjamesjacoby
Message:

First pass at extracting registered Notifications callbacks into a helper function. More to do here. See #5300. (1.9 branch)

Location:
branches/1.9/bp-notifications
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/1.9/bp-notifications/bp-notifications-classes.php

    r7697 r7712  
    554554            'item_id'           => false,
    555555            'secondary_item_id' => false,
    556             'component_name'    => array_keys( buddypress()->active_components ),
     556            'component_name'    => bp_notifications_get_registered_components(),
    557557            'component_action'  => false,
    558558            'is_new'            => true,
     
    613613        global $wpdb;
    614614
    615         $bp = buddypress();
    616 
    617615        $args = wp_parse_args( $args, array(
    618             'component_name' => array_keys( $bp->active_components ),
     616            'component_name' => bp_notifications_get_registered_components(),
    619617        ) );
    620618
  • branches/1.9/bp-notifications/bp-notifications-functions.php

    r7687 r7712  
    508508    return apply_filters( 'bp_notifications_get_total_notification_count', $count );
    509509}
     510
     511/**
     512 * Return an array of component names that are currently active and have
     513 * registered Notifications callbacks.
     514 *
     515 * @since BuddyPress (1.9.1)
     516 *
     517 * @see http://buddypress.trac.wordpress.org/ticket/5300
     518 */
     519function bp_notifications_get_registered_components() {
     520
     521    // 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 );
     526
     527    // Return active components with registered notifications callbacks
     528    return apply_filters( 'bp_notifications_get_component_names', $component_names );
     529}
Note: See TracChangeset for help on using the changeset viewer.