Okay, I muddled around until I found what I feel is the best solution. Please feel free to offer any constructive criticism. I concluded this was not possible with a single query, so I broke it into two queries.
The basic idea is to get all items matching each query, loop them to build an array of id’s, then perform a third query from just the id’s. While this is probably not the most performant solution; it does give back what I need, in the correct order, maintains pagination, etc.
First query gets all activity entries of a specific user (from a specific group in my case):
$firstQueryArgs = [
'show_hidden' => true,
'posts_per_page' => -1,
'filter' => [
'user_id' => $user,
'object' => 'groups',
'action' => 'activity_update',
'primary_id' => $group_id
]
];
Second query gets all activity items with a specific meta value:
$secondQueryArgs = [
'show_hidden' => true,
'posts_per_page' => -1,
'filter' => [
'object' => 'groups',
'action' => 'activity_update',
'primary_id' => $group_id
],
'meta_query' => [ [
'key' => 'share_guardian',
'value' => 'true',
'compare' => '='
] ]
];
Now, perform the queries, loop the results, and build an array of id’s:
// Get queries
$firstQuery = bp_activity_get( $firstQueryArgs );
$secondQuery = bp_activity_get( $secondQueryArgs );
// Loop each query and set ids
$ids = [];
foreach( $firstQuery['activities'] as $key => $act ) {
$ids[] = $act->id;
}
foreach( $secondQuery['activities'] as $key => $act ) {
$ids[] = $act->id;
}
Finally, I can perform the main query:
// Perform final query by ids
$finalQueryArgs = [
'show_hidden' => true,
'per_page' => 5,
'in' => $ids
];
$activity = bp_activity_get( $finalQueryArgs );
This is working well for my needs.