Skip to:
Content
Pages
Categories
Search
Top
Bottom

BBPress Notifications not Clearing Up


  • jovmbbuzz
    Participant

    @jovmbbuzz

    Good day!

    I have updated the bbpress plugin on the site and the automatic marking of notifications as read, once the link is clicked, seems gone. I have reverted back to the previous version to make this work.

    Can you kindly advise for a solution to make it work for the new version of the plugin? I would be a hassle to click on the read link to clear up notifications. By the way, it only happens when logged in to Safari.

    Please advise. Thank you!

Viewing 16 replies - 1 through 16 (of 16 total)

  • Robin W
    Moderator

    @robin-w

    1. which version of bbpress
    2. what do you mean by notifications? – that is not a bbress phrase, do you mean notify on the topic/reply form?
    3. so in addition to bbpress what other bbpress related plugins are you using ?


    Nik
    Participant

    @nikbond

    If I can jump in here, I’m fairly sure I’m experiencing the same problem with Buddypress notifications eg. “You have one new reply to topic X”. Clicking on the link used to mark the notification as “Read” but this is no longer happening.

    Currently using bbPress 2.6.4 and BuddyPress 5.1.2.

    Downgrading to bbPress 2.5.14 (an old version that I happened to have installed elsewhere) certainly fixes the problem but will have to do further investigation to work out exactly which version this issue originally started occurring.

    Either way, notifications are certainly not getting marked as read in version 2.6.4 when the link is clicked, although clicking on the “Mark Read” button still does.


    Robin W
    Moderator

    @robin-w

    @nikbond thanks, I don’t use buddypress, so have little experience of it, so any help you can provide would be great


    Nik
    Participant

    @nikbond

    @robin-w OK well… I’m pretty sure it’s arising from the file located in bbpress/includes/extend/buddypress/notifications.php where there is a function called function bbp_format_buddypress_notifications() which creates a link (which when clicked, automatically marks that particular notification as “read”).

    From the quick test I’ve just run, it would appear that the link/string created in more recent versions of bbPress may not be correct but I’ll need to do some more investigation to work out how/why.

    As far as I can tell, this is likely to be an issue for all Buddypress/bbPress users so I’m quite surprised it hasn’t been highlighted sooner.


    Robin W
    Moderator

    @robin-w

    I don’t monitor the buddypress support forum, it might be in there

    https://buddypress.org/support/


    Nik
    Participant

    @nikbond

    Yes I’ve seen there are several people reporting the same issue there but no useful responses as yet. Tbh the problem is obviously originating from bbPress (ie. it’s not formatting the links in the same way as it used to) but if/until a fix is forthcoming, I’m planning on seeing if I can find a work around myself.

    Will post back here if anyone is interested…


    Robin W
    Moderator

    @robin-w

    yes please post back your findings.

    Just taken a quick look, so using previous versions works – which version 2.5.14 or later ?


    Nik
    Participant

    @nikbond

    All I can say for now is that version 2.5.14 definitely does work, and the (latest) version 2.6.4 definitely does not. I haven’t yet had a chance to test the versions in between to be able to say for sure in which version this issue originally occurred.


    Robin W
    Moderator

    @robin-w

    so you couldput this in your functions file of your child theme, it takes out then new filter and puts back the old one

    remove_filter( 'bp_notifications_get_notifications_for_user', 'bbp_format_buddypress_notifications', 10, 8 );
    add_filter( 'bp_notifications_get_notifications_for_user', 'rew_format_buddypress_notifications', 10, 5 );
    
    function rew_format_buddypress_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) {
    
    	// New reply notifications
    	if ( 'bbp_new_reply' === $action ) {
    		$topic_id    = bbp_get_reply_topic_id( $item_id );
    		$topic_title = bbp_get_topic_title( $topic_id );
    		$topic_link  = wp_nonce_url( add_query_arg( array( 'action' => 'bbp_mark_read', 'topic_id' => $topic_id ), bbp_get_reply_url( $item_id ) ), 'bbp_mark_topic_' . $topic_id );
    		$title_attr  = __( 'Topic Replies', 'bbpress' );
    
    		if ( (int) $total_items > 1 ) {
    			$text   = sprintf( __( 'You have %d new replies', 'bbpress' ), (int) $total_items );
    			$filter = 'bbp_multiple_new_subscription_notification';
    		} else {
    			if ( !empty( $secondary_item_id ) ) {
    				$text = sprintf( __( 'You have %d new reply to %2$s from %3$s', 'bbpress' ), (int) $total_items, $topic_title, bp_core_get_user_displayname( $secondary_item_id ) );
    			} else {
    				$text = sprintf( __( 'You have %d new reply to %s',             'bbpress' ), (int) $total_items, $topic_title );
    			}
    			$filter = 'bbp_single_new_subscription_notification';
    		}
    
    		// WordPress Toolbar
    		if ( 'string' === $format ) {
    			$return = apply_filters( $filter, '<a href="' . esc_url( $topic_link ) . '" title="' . esc_attr( $title_attr ) . '">' . esc_html( $text ) . '</a>', (int) $total_items, $text, $topic_link );
    
    		// Deprecated BuddyBar
    		} else {
    			$return = apply_filters( $filter, array(
    				'text' => $text,
    				'link' => $topic_link
    			), $topic_link, (int) $total_items, $text, $topic_title );
    		}
    
    		do_action( 'bbp_format_buddypress_notifications', $action, $item_id, $secondary_item_id, $total_items );
    
    		return $return;
    	}
    }

    Nik
    Participant

    @nikbond

    @robin-w Thank you and yes… I was already considering something similar as a temporary fix, although hopefully it’s something bbPress will address at some stage soon as it’s clearly an issue that will be causing problems for a lot of users…


    mattiejas
    Participant

    @mattiejas

    I have the same problem on my website also with bbPress 2.6.4 and BuddyPress 5.1.2. @robin-w Thanks for the suggested fix. Unfortunately, inserting your code into my child theme’s functions.php did not fix the problem for me.


    mattiejas
    Participant

    @mattiejas

    … for information, link to the buddypress topic: https://buddypress.org/support/topic/notifications-not-clearing/


    adishor22
    Participant

    @adishor22

    I have this problem too, and it also occurs on another, larger bbPress forum where I am a moderator.

    I’ve asked someone who knows PHP to take a look at the code in bbpress/includes/extend/buddypress/notifications.php, but the couldn’t find any problem there.

    I’m not sure if they were onto something or not, but they said the bug might originate in an incorrect reference to the database topic/post IDs, similarly to what @nikbond said above.

    Robin’s solution above does not seem to work for me either.


    adishor22
    Participant

    @adishor22

    It looks like this is a known bug, and a patch might be implemented in the future (see “Attachments”):
    https://bbpress.trac.wordpress.org/ticket/3341

    Editing bbpress/includes/extend/buddypress/notifications.php as shown there has fixed the issue for me.


    mattiejas
    Participant

    @mattiejas

    Swell, thanks so much @adishor22!


    adishor22
    Participant

    @adishor22

    No problem! It seems to work perfectly so far — but only for notifications generated after the patch is applied. Older ones still need to be marked as read manually.

Viewing 16 replies - 1 through 16 (of 16 total)
  • You must be logged in to reply to this topic.
Skip to toolbar