Skip to:

Does Filtering Activity Stream Inherently Lead to Errors in BP?

  • Natalie


    I’ve been trying to filter only the Activity Directory stream to show only a specific activity item type (in this case, it’s “new_product_page”, which I created with the help of the codex section on post types).

    I successfully managed to achieve this with the following code:

    function bpfr_filtering_activity( $retval ) {
    if ( bp_is_page( 'activity' ) ) {
    	// activities to filter on, comma separated
    	$retval['action'] = 'new_product_page, ';
    	$retval['max'] = '50';
    		return $retval;
    add_filter( 'bp_before_has_activities_parse_args', 'bpfr_filtering_activity' );

    Although eventually I started to notice some errors where users were getting notification URLs (e.g. “John commented on one of your updates”) where the notification URLs weren’t appending the comment identifier at the end (e.g. /activity/p/762/?rid=310#acomment-780), instead ending prematurely with only the users referrer ID (e.g. /activity/p/762/?rid=310).

    This means the notification URLs would take you to the commented user’s profile, rather than the specific comment.

    After removing the above code from filtering the activity directory, suddenly all of the notification URLs issues went away and everything appeared to work flawlessly.

    I recall a wordpress developer once stating that is is advised NOT to block activity_comment and activity_update activities, because it will cause errors in BuddyPress.

    What I am wondering is if this is true? And, if there is a way to filter the Activity Directory to show only a specific post type (e.g. new_product_page) without it leading to errors elsewhere in BP? Is there a correct way to do it?

  • You must be logged in to reply to this topic.
Skip to toolbar