Forums Forums Search & Filter Pro Filter input arguments before they get to S&F

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #68948

    Hello!
    I’d like to filter one or all input components of a search form and change what the user put into them, before sending them to S&F.

    Something like

    function filter_input_values($inputs, $sfid){
       if($sfid==365){
          if($inputs['_sf_s']['value']) $input['_sf_s']['value'] = NULL;
       }
       return $inputs;
    }
    add_filter('sf_filter_input_values','filter_input_values', 10, 2);

    Any way of acting upon input values like this?
    My reason for doing this is for using a field of the search to transfer some data to my backend login, but without changing/impacting the search itself. Or in some cases just correct address data that a user didn’t enter properly.

    Trevor
    #68982
    Anonymous
    #68984

    Thank you Trevor! The issue I was having with sf_edit_query_args is that $query_args was empty. I read around in the forum and it turns out I had to use a different priority than the one specified in the docs (like 100) to get results in $query_args using this filter.

    Trevor
    #68986

    Sorted then?

    Anonymous
    #68989

    Yes, thank you!

Viewing 5 posts - 1 through 5 (of 5 total)