#3638 closed defect (bug) (fixed)
Redirect broken on BuddyPress "new reply" notifications
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.6.14 | Priority: | normal |
Severity: | normal | Version: | 2.6.13 |
Component: | Extend - BuddyPress | Keywords: | needs-testing |
Cc: |
Description
Hi,
I believe there's a bug introduced in the last change to includes/extend/buddypress/notifications.php
It seems like the code block under "If topic has replies" was overlooked when changing the value of the notification "action" to include the topic ID.
The behaviour I'm seeing is that when a user clicks on a new reply notification in their notifications list, they are sent to the topic's main page, rather than the reply the notification was for.
I believe this is happening because:
- The code which loops over replies (which, btw, is a little painful on topics with hundreds of pages of replies!) is still using the old action value. On our site we haven't had a plain "bbp_new_reply" notification recorded since 2021, they all have the topic ID appended. So I don't think this code is doing anything now.
- If that code is updated to include the topic ID, there is still an issue: all notifications for that topic are marked as read by the call to bp_notifications_mark_notifications_by_type() before this loop occurs. So there's no chance of a particular reply being identified as being marked read after that, and the default redirect_id is left as the topic.
On our site we have addressed this by:
- Updating the component action to include the topic ID in this loop too.
- Moving the bp_notifications_mark_notifications_by_type() call to after the loop rather than before.
This seems to produce the expected behaviour i.e. All notifications for a topic are cleared, but the redirect goes to the most recent reply which had an unread notification.
Diff of changes