[buddypress-trac] [BuddyPress Trac] #7125: Apostrophe not handled correctly in activity filter array.
buddypress-trac
noreply at wordpress.org
Thu Jun 16 11:45:12 UTC 2016
#7125: Apostrophe not handled correctly in activity filter array.
--------------------------+-----------------------------
Reporter: IdleWanderer | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Not sure | Version: 2.5.0
Severity: normal | Keywords:
--------------------------+-----------------------------
Hi!
I posted this in the support forum, and someone suggested it probably is a
bug. So here's the issue:
Basically, this is what I want and what I 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 the page for that particular
species, as long as the name of the species is mentioned. Now, this I can
do (thanks to help in the forums), 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 course, I got an error doing this.
I tried solving this in two ways. First, by escaping, like this:
{{{
'value' => 'keast\'s tube-nosed fruit bat',
}}}
And again, doing this:
{{{
'value' => "keast's tube-nosed fruit bat",
}}}
Both of them worked in the sense that there were no errors, but neither of
them worked when it came to actually showing the term with the apostrophe.
Which is the whole point in the first place. The conclusion in the forum
was it likely is a bug that doesn't handle the apostrophe correctly
upstream.
So, is this a bug, and can it be fixed?
Thanks,
Havard
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/7125>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac
More information about the buddypress-trac
mailing list