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.

Embedding Wordpress User ID

  1. mostlyjan
    Member

    Hi there,
    I bought the regular license. How do i embed the WordPress user ID of the person submitting a form?
    All our forms will require that people are logged in. I want to pass the submitter's wordpress ID to verify that they are who they say they are.
    thanks!

    Posted 7 years ago on Wednesday May 1, 2013 | Permalink
  2. Add the following code the the Theme Function file:

    add_filter("gform_field_value_userID", "populate_userID");
    function populate_userID($value){
    $current_user = wp_get_current_user();
    return $current_user->display_name;
    }

    After that, go to your form.
    Insert a 'Hidden Field'.
    Click the 'Advanced' tab.
    Check the box for 'Allow field to be populated dynamically.'
    Set the 'Parameter Name' to userID.
    Click the 'Update Form' button.

    Hope this does the job!

    Posted 7 years ago on Wednesday May 1, 2013 | Permalink
  3. mostlyjan
    Member

    created a child theme with that function and it worked like a charm. Thanks much !

    Posted 7 years ago on Thursday May 2, 2013 | Permalink
  4. Glad I could be of assistance.

    Posted 7 years ago on Thursday May 2, 2013 | Permalink

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