Hey Nick
Very much appreciated – I was just working through as I found that example. I have a form with the ID: 2. So in my functions.php I’ve put the following:
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_referrer_example', 10, 3 );
function salesforce_w2l_field_value_referrer_example( $val, $field, $form ){
$form_id = 2; // form id to act upon
$field_name = 'Remote_Addr__c'; // API Name of the field you want to autofill
if( $form == $form_id && $field_name == $field ){
if( isset( $_SERVER['REMOTE_ADDR'] ) ){
return $_SERVER['REMOTE_ADDR'];
}
}
return $val;
}
I had based this code off your examples you kindly pointed out (helpful as i’m really new to development). The form id is 2, and the field “Remote_Addr__c” is one I have in my salesforce:
Eg: https://screencast.com/t/bbmJmOmJry
The only part of this i don’t think i fully understand which i’m not sure if its impacting it is this:
add_filter( 'salesforce_w2l_field_value', 'salesforce_w2l_field_value_referrer_example', 10, 3 );
I’m not sure if 10, 3 needs to be changed to something… or perhaps something else…
Are you able to point me in the right direction as i’ve cleared all my cache and can’t seem to get this darn ip stored which would be sooo helpful to me.
Thanks!