5

URL sample: http://www.samplesite.com/?companyname=abcltd

I want to grab values passed in url in a formidable hidden field. I added [get param=companyname] in the hidden field value. Works well when i am logged in as admin.

BUt if i logout, I try to access the form from url, the value doesnt get populated in hidden field.

function frm_set_checked($values, $field){

if($field->id == 104){

      $values['value'] =  $_GET['companyname'] ;

   }

}

add_filter('frm_setup_new_fields_vars', 'frm_set_checked', 8, 2);
add_filter('frm_setup_edit_fields_vars', 'frm_set_checked', 8, 3);

also tried using hook. Same things happend. for logged in user it populates the param value in hidden field. For non-logged in user it doesn't populate param value in hidden field.

Thanks for any help in advance

Parag
  • 4,754
  • 9
  • 33
  • 50
  • Are you sure that `$field->id == 104`? Could you print `$_GET`? – GuyT Sep 09 '15 at 08:12
  • I am quiet sure about it, if I login as admin the same thing works. But not for non-logged in user – Parag Oct 05 '15 at 03:38
  • Since you are using a filter, shouldn't the $value arg be returned. e.g. `function frm_set_checked($values, $field){ if($field->id == 104){ $values['value'] = $_GET['companyname'] ; } return $values; }` – deronimo Jun 30 '16 at 06:26

1 Answers1

0

The fourth parameter of an add_filter function is the number of parameters you`ll give in your function. So if your frm_set_checked has ($values, $fields) the add_filter should be add_filter('frm_setup_new_fields_vars', 'frm_set_checked', 8, 2);