I am trying to use the new filter for changing field values. I have a custom formfield named “JBN Nummer” and I want this to be filled with the users jbn_number from wp_user.
This is my code but nothing happens:
function my_formfield_filter($formfield,$postfield_name,$value) {
// do a print_r of $formfield, etc ... to see the content. Check the wordpress userid with wp_get_current_user() and do all magic you want :-)
// as an example, let's change the value of a field if it is called 'testfield')
$current_user = wp_get_current_user();
$jbn = $current_user->jbn_number;
if ($formfield['field_name']=='JBN Nummer') {
return $jbn;
} else {
return $value;
}
}
add_filter('eme_field_value_filter','my_formfield_filter',10,3);
What am I doing wrong?
-
This reply was modified 5 years, 11 months ago by pvwij.
-
This reply was modified 5 years, 11 months ago by pvwij.