Skip to:
Content

BuddyPress.org

Opened 6 years ago

Closed 5 years ago

#5558 closed enhancement (fixed)

bp_has_notifications() additional filtering does not work

Reported by: r-a-y Owned by: r-a-y
Milestone: 2.1 Priority: normal
Severity: normal Version: 1.9
Component: Toolbar & Notifications Keywords: needs-refresh commit
Cc:

Description

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 BP_Notifications_Template.
  • 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.

Attachments (2)

5558.01.patch (9.3 KB) - added by r-a-y 6 years ago.
5558.02.patch (8.9 KB) - added by r-a-y 5 years ago.
Updated patch for posterity.

Download all attachments as: .zip

Change History (7)

@r-a-y
6 years ago

This ticket was mentioned in IRC in #buddypress-dev by r-a-y. View the logs.


5 years ago

This ticket was mentioned in IRC in #buddypress-dev by paulgibbs. View the logs.


5 years ago

#3 @DJPaul
5 years ago

  • Keywords needs-refresh commit added; has-patch removed

Sorry r-a-y that it's taken so long for someone to look at your patch. I think the enhancement is fine, and the unit test works as expected. However, it was pretty hard to get the patch to apply to current trunk (to be expected after three months, really). It would be nice to get this into 2.1; do you think you have time to update the patch and then commit it?

This ticket was mentioned in IRC in #buddypress-dev by paulgibbs. View the logs.


5 years ago

@r-a-y
5 years ago

Updated patch for posterity.

#5 @r-a-y
5 years ago

  • Owner set to r-a-y
  • Resolution set to fixed
  • Status changed from new to closed

In 8761:

Allow notifications loop to accept all available parameters.

Previously, the notifications loop accepted only a subset of parameters
from the BP_Notification_Notification::get() method. This made
notification loop filtering very restrictive.

This commit opens up the notifications loop so all parameters are available
as per the BP_Notifications_Notification::get() fetch method.

Fixes #5558.

Note: See TracTickets for help on using tickets.