Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
11/16/2013 01:08:49 AM (12 years ago)
Author:
johnjamesjacoby
Message:

Allow non-core components to hook into notifications via a filter. This allows components that are not registered as part of the main BuddyPress singleton to hook a callback into a filter instead. See #5148.

File:
1 edited

Legend:

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

    r7559 r7578  
    691691        $notification = $bp->notifications->query_loop->notification;
    692692
    693         // Skip inactive components
    694         if ( ! bp_is_active( $notification->component_name ) ) {
    695             return;
    696         }
    697 
    698693        // Callback function exists
    699694        if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) {
     
    703698        } elseif ( isset( $bp->{ $notification->component_name }->format_notification_function ) && function_exists( $bp->{ $notification->component_name }->format_notification_function ) ) {
    704699            $description = call_user_func( $bp->{ $notification->component_name }->format_notification_function, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 );
     700
     701        // Allow non BuddyPress components to hook in
     702        } else {
     703            $description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ) );
    705704        }
    706705
Note: See TracChangeset for help on using the changeset viewer.