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.

Getting duplicate user ids from different users when populating field by cookie

  1. Hi,
    I'm populating a hidden field (snid - a userId, stored as 'sn' in the cookie) with data from the user's cookie. Everything seems to be working correctly, yet when I sort Entries by snid, every 15 or 20 entries has a duplicate snid, everything else captured: name, address, email etc., is fine but somehow the cookie-populated field seems to have carried over to another entry.
    Here is the code for putting the cookie in the form:

    add_filter("gform_field_value_snid", "populate_snid");

    function populate_snid() {
    if ( isset( $_COOKIE['oatmeal'] ) ) {
    $tmp = $_COOKIE['oatmeal'];
    $tmp = wp_parse_args( $tmp );
    $snid_value = $tmp['sn'];
    if ( strlen( $snid_value ) < 1 ){
    $snid_value = 'unable to determine snid';
    }
    } else {
    $snid_value = 'no cookie info.';
    }
    return $snid_value;
    }

    Thanks

    Posted 13 years ago on Monday June 27, 2011 | Permalink
  2. How are you setting the value in the cookie? Because the hidden field is going to be populated using your code above, that is the only place it's going to be able to know that value, so the other piece of this is the cookie itself and the code related to creating the cookie.

    Posted 13 years ago on Monday June 27, 2011 | Permalink
  3. ahh yes, that cookie is being set on login by the java side of the site. It could be an issue on that side.

    Posted 13 years ago on Monday June 27, 2011 | Permalink

This topic has been resolved and has been closed to new replies.