Skip to:
Content
Pages
Categories
Search
Top
Bottom

Friends only activity stream function loses mentions


  • kobrakai75
    Participant

    @kobrakai75

    Hi all

    After a lot of searching around I found a solution for a friends only activity stream.

    The following function works and I am only seeing updates from friends:

    function buddydev_friends_only_activity_args( $args ) {
        
        if( ! bp_is_activity_directory() || !  is_user_logged_in() ) {
            return $args;
        }
        
        $user_id = get_current_user_id();
        
        $user_ids = friends_get_friend_user_ids( $user_id );
        
        //include users own too?
        array_push( $user_ids, $user_id );
        
        $args['user_id'] = $user_ids;
        
        //print_r($args);
        return $args;
     
    }
    
    add_filter( 'bp_after_has_activities_parse_args', 'buddydev_friends_only_activity_args' );

    However, the mentions tab on my activity stream now displays the message “Sorry, there was no activity found.” If I remove the function I can see all the mentions again.

    Mentions are still working fine on user profiles.

    Any ideas what is causing this?

    WordPress 5.2.2
    BuddyPress 4.4.0

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