This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Reply To: Ajax Search to respect visibility set by B2BKing

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Ajax Search to respect visibility set by B2BKing Reply To: Ajax Search to respect visibility set by B2BKing

#37434
erikleirdalerikleirdal
Participant

B2BKing replied. I have not tested the Free version of you so I dont know if that works. But this is their code,

add_filter(‘asl_query_args’, array($this, ‘asl_query_args_postin’), 10, 1);
function asl_query_args_postin($args) {
$args[‘post_in’] = is_array($args[‘post_in’]) ? $args[‘post_in’] : array();
if (!defined(‘ICL_LANGUAGE_NAME_EN’)){
$allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’);
} else {
$allTheIDs = get_transient(‘b2bking_user_’.get_current_user_id().’_ajax_visibility’.ICL_LANGUAGE_NAME_EN);
}
$allTheIDs = apply_filters(‘b2bking_ids_post_in_visibility’, $allTheIDs);
$currentval = $args[‘post_in’];
if (!empty($currentval) && $allTheIDs !== false){
$allTheIDs = array_intersect($allTheIDs, $currentval);
}

if ($allTheIDs){
if(!empty($allTheIDs)){
$args[‘post_in’] = array_merge($args[‘post_in’], $allTheIDs);
}
}
return $args;
}