Reply To: how to combine activity tabs to one
I’ve achieved what I wanted. Most likely in an incredibly convoluted way.
If anyone can see any glaring issues with my code please shout. I’m a ludite when it comes to querying databases, arrays, etc.
// Create the array for post ids related to the users industry
global $wpdb;
$industry = xprofile_get_field_data( 2, $user_id, false );
$metas = $wpdb->get_results ( "SELECT activity_id FROM wp_bp_activity_meta WHERE meta_value='$industry'" );
$metasjson = json_decode( json_encode($metas), true);
$newList = array();
foreach($metasjson as $key=>$listItem) {
$newList[$key] = $listItem['activity_id'];
}
Then I added the below to your $retval
// Get Posts in Specified Category
array(
'relation' => 'AND',
array(
'column' => 'id',
'compare' => 'IN',
'value' => (array) $newList
)
),