Skip to:
Content
Pages
Categories
Search
Top
Bottom

Reply To: How to create activity streams based on words or hashtags?

@idlewanderer

Participant

I tried it, but it din’t work. At least it didn’t stop the filter rules already set up, like they did when I tried before.. So only words with lion shows up, but also sea lion.. Even with the code set up exactly like yours. Like this:

function my_bp_activities_search_term_on_page_241( $retval ) {
    // Add search term for correct page
    if ( is_page(241) ) {
         $filter_query[] = array(
        'relation' => 'OR',
        array(
    'column'  => 'content',
    'value'   => 'lion',
    'compare' => 'LIKE',
    array(
        'column'  => 'content',
        'value'   => 'sea lion',
        'compare' => 'NOT LIKE'
    )
),
           array(
    'column'  => 'content',
    'value'   => 'lion',
    'compare' => 'LIKE',
    array(
        'column'  => 'content',
        'value'   => 'sea lion',
        'compare' => 'NOT LIKE'
    )
  ),
);
    $retval['filter_query'] = $filter_query;
    }
 
    return $retval;
}
add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_search_term_on_page_241' );
Skip to toolbar