Hi,
Previous topic for more info - https://toolset.com/forums/topic/split-user-stored-preference-data-changes-search-results-generic-field-default-value-edit-form/#post-2708877.
The user stored data still does not work like I want it to, but the biggest problem is that now, user can't "reset" with search filter their search.
So, user fills a form in their account, then automatically goes to property search with the predefined data from the form. So far, so good, but when in search view, the reset button no longer resets their filters and they have to go back to account to change them.
I'm not good with php, so I don't know how to tell the code to reset the predefined filters wherever the certain reset button appears.
Code:
add_filter('wpv_filter_query', 'func_user_selected_city_listing_cat', 99, 3);
function func_user_selected_city_listing_cat($query_args, $setting,$view_id) {
if($view_id == 9980 and is_user_logged_in() and pms_is_member() ) {
global $current_user;
$user_id = $current_user->ID;
$user_city = get_user_meta($user_id,'city',true);
$user_listing_category = get_user_meta($user_id,'listing_category',true);
if($user_city) {
$query_args['meta_query'][] = array('key'=>'city',
'value'=>$user_city,
'type'=>'CHAR',
'compare'=> '=');
}
if($user_listing_category) {
$query_args['tax_query'][] = array(
'taxonomy'=> 'listing_category',
'field' => 'id',
'terms' => $user_listing_category,
'operator' => 'IN');
}
}
return $query_args;
}
add_shortcode('is_pms_member','func_is_pms_member');
function func_is_pms_member(){
$status = pms_is_member();
return $status;
}