• Resolved Kindler

    (@pedrotrindade)


    Hello,

    I have a user role called Partners where I’ve added some custom fields such as “Company Name”, “VAT Number” and phone number.

    I have a number of forms that I want my Partners to have pre-filled (when logged in) with the info that is associated with their user, not only custom fields but also “Email” “First Name” etc..

    Is there anyway that Caldera can achieve this ?

    Thank you for your time.

    Best Regards,
    Pedro Trindade

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor christiechirinos

    (@christiechirinos)

    Hi Kindler,

    Thanks for your interest Caldera Forms. This is a really great question and we’d be happy to help. Do you mind sending us a message through our site so we can follow up directly?

    You can contact us with any questions by filling out this form — yes, it is a Caldera Form ??

    https://CalderaForms.com/contact

    Thread Starter Kindler

    (@pedrotrindade)

    Meanwhile I figured it out.
    For any Caldera users out there wondering how to achieve this, the answer is query vars.
    On your form page, or page template(s), create a user object for the current user like this:
    $user = get_user_by(‘id’, get_current_user_id());

    Get the field (if you’re using ACF)
    $yourField = get_field(‘yourFieldID’, $user);

    Create the query var:
    set_query_var(‘yourQueryVarName’, $yourField);

    Lastly, assign your query var to the caldera field default value:
    {query_var:yourQueryVarName}

    And thats it, now your logged in have prefilled form fields.
    Happy Coding.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pre-filled Form Fields for Users’ is closed to new replies.