PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Passing An Affiliate ID into form field

  1. Hello,

    I use Affiliate Plugin on my Wordpress site and would like to pass the referrer ID into a hidden field.
    The referrer ID can be retrieved from the affiliate plugin using the following line of code:

    $referrer_id = $_COOKIE['ap_id'];

    Please advise how I can pass this information programmatically into a hidden field?

    Posted 11 years ago on Saturday September 8, 2012 | Permalink
  2. David Peralty

    Create the hidden field, go to advanced and put a check mark in the allow field to be populated dynamically and give it a parameter name... then take a look at the following documentation:

    http://www.gravityhelp.com/documentation/page/Gform_field_value_$parameter_name

    You should be able to then grab your variable value and push it into your hidden field.

    Posted 11 years ago on Saturday September 8, 2012 | Permalink
  3. Hi David,

    I tried your passing a hard coded date as per the instructions and it worked. When I modified the code to try and pass the referrer ID it fails. Here's the code:

    <?php
    add_filter("gform_field_value_referral", "populate_referral");
    function populate_referral($value){
    return $referrer_id = $_COOKIE['ap_id'];
    }
    ?>

    Can you please offer some assistance on how I would modify the code (as you can tell I'm just not that familiar with php).

    Thanks very much!

    Posted 11 years ago on Thursday September 27, 2012 | Permalink
  4. David Peralty

    Sorry, I don't understand the issue currently. Is it just not picking up on the Cookied value but it worked when you had it as a hard coded value? Or do you have two things being filed out via the same method?

    Posted 11 years ago on Thursday September 27, 2012 | Permalink