I have a profile field with checkboxes where users can check their "interests". I'd like to customize the activity feed by scoping it down with a search string including the users interests. Following the search term method here (the example with "nap"): http://ift.tt/1vr6XNF
I have this at the top of activity-loop.php:
<?php
$activity_search_terms = "&search_terms=";
if ( $interests = xprofile_get_field_data( 'Interests', bp_loggedin_user_id() ) ) {
foreach ( $interests as $interest ) {
$activity_search_terms .= strtolower($interest) . "+";
}
}
?>
<?php if ( bp_has_activities( bp_ajax_querystring( 'activity' ) . $activity_search_terms ) ) : ?>
This would work perfectly if the activity search were using an OR query instead of an AND query. Right now if a user clicks "yoga" and "crossfit" as interests, the activity feed is only posts with BOTH those terms instead of EITHER.
I installed Relevanssi and have it set to OR query, but it doesn't appear to apply to the activity search. Is there a way to force an OR query for bp_has_activities?
Using WP 4.1 and BP 2.1.1
Aucun commentaire:
Enregistrer un commentaire