[buddypress-trac] [BuddyPress Trac] #6669: Blank notifications when using the bp_notifications_get_notifications_for_user filter hook

buddypress-trac noreply at wordpress.org
Sun Oct 18 01:14:28 UTC 2015


#6669: Blank notifications when using the
bp_notifications_get_notifications_for_user filter hook
---------------------------------------+------------------------------
 Reporter:  henry.wright               |       Owner:
     Type:  defect (bug)               |      Status:  new
 Priority:  normal                     |   Milestone:  Awaiting Review
Component:  Component - Notifications  |     Version:  2.3.3
 Severity:  normal                     |  Resolution:
 Keywords:  reporter-feedback          |
---------------------------------------+------------------------------
Changes (by r-a-y):

 * keywords:   => reporter-feedback


Comment:

 When working with filters, you need to return something when you are not
 working with your own conditional statement; that's why you are getting a
 `null` value for other notifications.

 Your example should look something like this:

 {{{
 function step_2a( $component_action, $item_id, $secondary_item_id,
 $item_count, $format = 'string' ) {
     if ( $component_action === 'my_first_component' ) {
         // Do something making sure to return the appropriate type (array
 in this case).
         return array( CUSTOM_ARRAY );
     }

     // Make sure you return the default value so other notifications will
 still work
     return $component_action;
 }
 add_filter( 'bp_notifications_get_notifications_for_user', 'step_2a', 10,
 5 );
 }}}

 Let me know if that works for you.

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6669#comment:4>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list