Skip to content

Instantly share code, notes, and snippets.

@New0
Created February 6, 2020 11:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save New0/af2e101b2832e679aa323cafb794f666 to your computer and use it in GitHub Desktop.
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
<?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