[buddypress-trac] [BuddyPress Trac] #5558: bp_has_notifications() additional filtering does not work

buddypress-trac noreply at wordpress.org
Thu Apr 17 16:09:40 UTC 2014

#5558: bp_has_notifications() additional filtering does not work
 Reporter:  r-a-y          |      Owner:
     Type:  enhancement    |     Status:  new
 Priority:  normal         |  Milestone:  2.1
Component:  Notifications  |    Version:  1.9
 Severity:  normal         |   Keywords:  has-patch
 At the moment, `bp_has_notifications()` cannot be used when trying to do
 finer-grained filtering.

 For example, `if ( bp_has_activities( 'component_name=activity' ) )` will
 grab all notifications instead of just activity-related ones.

 Attached patch:

 * Swaps out
 `BP_Notifications_Notification::get_current_notifications_for_user()` with
 the more, liberal `BP_Notifications_Notification::get()`.  This allows
 `bp_has_notifications()` to be used in a less-restricting manner.

 * Fleshs out the default arguments in both `bp_has_notifications()` /
 `BP_Notifications_Template` to use everything available.  We don't have to
 do this in two places.  At the very least, this should be done in
 * Fixes the `$is_new` variable being undefined if `bp_has_notifications()`
 is used outside of a user's notifications page.
 * Fixes the `$max` argument in `BP_Notifications_Template`.
 * Adds a unit test.

Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5558>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac

More information about the buddypress-trac mailing list