Skip to:
Content

bbPress.org

Opened 15 months ago

Closed 14 months ago

Last modified 14 months ago

#3638 closed defect (bug) (fixed)

Redirect broken on BuddyPress "new reply" notifications

Reported by: cjerrells Owned by: johnjamesjacoby
Priority: normal Milestone: 2.6.14
Component: Extend - BuddyPress Version: 2.6.13
Severity: normal Keywords: needs-testing
Cc:

Description

Hi,

I believe there's a bug introduced in the last change to includes/extend/buddypress/notifications.php

https://bbpress.trac.wordpress.org/changeset/7183/trunk/src/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:

  1. 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.
  1. 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:

  1. Updating the component action to include the topic ID in this loop too.
  1. 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.

Attachments (1)

notifications.diff (639 bytes ) - added by cjerrells 15 months ago.
Diff of changes

Download all attachments as: .zip

Change History (4)

@cjerrells
15 months ago

Diff of changes

#1 @johnjamesjacoby
14 months ago

  • Keywords needs-testing added
  • Milestone Awaiting Review2.6.14
  • Owner set to johnjamesjacoby
  • Status newassigned

#2 @johnjamesjacoby
14 months ago

  • Resolutionfixed
  • Status assignedclosed

In 7307:

Extend - BuddyPress - Notifications: redirect to reply when clicking a notification.

This change ensures that members are redirected to the appropriate reply URL rather than the parent topic URL.

It also now marks replies before marking the topic, and combines the updated rows together.

Props cjerrells.

In branches/2.6, for 2.6.14.

Fixes #3638.

#3 @johnjamesjacoby
14 months ago

In 7308:

Extend - BuddyPress - Notifications: redirect to reply when clicking a notification.

This change ensures that members are redirected to the appropriate reply URL rather than the parent topic URL.

It also now marks replies before marking the topic, and combines the updated rows together.

Props cjerrells.

In trunk, for 2.7.

Fixes #3638.

Note: See TracTickets for help on using tickets.