Created
February 6, 2020 11:18
-
-
Save New0/af2e101b2832e679aa323cafb794f666 to your computer and use it in GitHub Desktop.
Set the browser details "HTTP_USER_AGENT" in a Caldera Forms hidden field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Set the HTTP_USER_AGENT as the value of a hidden field during submission | |
* In this case the hidden field ID is fld_7526079, that needs to be edited | |
*/ | |
add_filter( 'caldera_forms_process_field_hidden', function( $value, $field ) { | |
//Change your field ID here | |
if( $field['ID'] === "fld_7526079" ){ | |
$value = $_SERVER['HTTP_USER_AGENT']; | |
} | |
return $value; | |
}, 10, 2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment