Skip to:
Content
Pages
Categories
Search
Top
Bottom

Use several filter arguments


  • Mr3k
    Participant

    @mr3k

    Hello,

    I’ve a question on filter activity items. I’ve found that I can filter on for example user_id and then give several ids, and at the same time give a object as for example “groups”. This filter is now applied that it only shows the ids AND object “groups”. Is there anyway to use like the union instead. So the ids OR “groups”?

    The code I use:

    function 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;
        $args['object'] = 'groups';
    
        //print_r($args);
        return $args;
     
    }
    add_filter( 'bp_after_has_activities_parse_args', 'friends_only_activity_args' );

    Thanks for any suggestion!

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