Problems with filtering the activity stream
-
Hi there,
For a while back I got lots of help in this forum on how to filter the activity stream for specific pages using parse_args. It has been great so far, but I have come across a small issue with some of the terms I want filtered.
Basically, this is what I want and what am doing so far:
If a user writes about a specific species of animal, whatever the user wrote will come up on the activity stream for that particular species, as long as the name of the species is mentioned. Now, this I can do (thanks to help in here), but a few animals have a species name with an apostrophe in it, and that’s where my problem arises.Here’s an example of what I want done:
function my_bp_activities_search_term_on_page_3431( $retval ) { // Add search term for correct page if ( is_page(3431) ) { $filter_query[] = array( 'relation' => 'OR', array( 'column' => 'content', 'value' => 'keast's tube-nosed fruit bat', 'compare' => 'LIKE' ), array( 'column' => 'content', 'value' => 'keast's tube-nosed bat', 'compare' => 'LIKE' ), array( 'column' => 'content', 'value' => 'nyctimene keasti', 'compare' => 'LIKE' ), ); $retval['filter_query'] = $filter_query; } return $retval; } add_filter( 'bp_after_has_activities_parse_args', 'my_bp_activities_search_term_on_page_3431' );
Of couse, this gives me an errer. I looked the issue up on google, and it seemed that the problem would be fixed by writing it like this:
'value' => 'keast\'s tube-nosed fruit bat',
Now, when doing this I no longer get the fatal error, but if I write “keast’s tube-nosed fruit bat” in the activity stream, it won’t show where it should.
So, how can I solve this and have “keast’s tube-nosed fruit bat” show?
Thanks!
- You must be logged in to reply to this topic.