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.

How to pass values from one form to another and allow to update

  1. Mike_sa
    Member

    I am very new to Gravity forms.

    I have a form " registration form" that is setting up and saving only the standard sign up details to the wp users db, it does not save the other input fields to the specific user on their profile.

    The form is saving all of the fields that have been filled in on the form in the entries that is found in the edit area of this form.

    I need to pass these values to the my profile page on the site and display them in an identical form just without the captcha on the form. both forms have been setup to allow content to be prepopulated with identical field names.

    If the user updates their profile on this form I need it too update the details saved in the registration entries.

    I have only every used gravity forms for simple contact forms before and am total lost :S

    This is rather urgent, could someone please point me in the right direction, I have looked at many of the forum posts but only ended up get more confused :s

    Thanks

    Posted 11 years ago on Friday August 10, 2012 | Permalink
  2. Mike_sa
    Member

    I have managed to to the registration form to save the field entries to the wp usermeta and the profile page to pull the values of the various fields from the user database.

    I now have an issue with updating the various field values to the WP_usermeta.... I have looked at so many forum post on all sorts of websites and have yet to find an answer that works...

    Could someone please help, this is rather urgent, below is my code that retrieves and populates the profile form.... I just need to get it too save any updates made to the form including if the password is updated.

    I cannot provide a url as I am working locally using mamp.


    add_action( 'show_user_profile', 'show_extra_profile_fields' );
    add_action( 'edit_user_profile', 'show_extra_profile_fields' );

    //show_extra_profile_fields add extra meta fields to user profile on the back end of WP in the meta
    function show_extra_profile_fields( $user ) { ?>

    <h3>Extra profile information</h3>

    <table class="form-table">

    <tr>
    <th><label for="title">Title</label></th>

    <td>
    <input type="text" name="title" id="title" value="<?php echo esc_attr( get_the_author_meta( 'Title', $user->ID ) ); ?>" class="regular-text" />

    </td>

    </tr>
    <tr>

    <th><label for="gender">Gender</label></th>

    <td>
    <input type="text" name="gender" id="gender" value="<?php echo esc_attr( get_the_author_meta( 'Gender', $user->ID ) ); ?>" class="regular-text" />

    </td>
    </tr>
    <tr>
    <th><label for="dob">DOB</label></th>

    <td>
    <input type="text" name="dob" id="dob" value="<?php echo esc_attr( get_the_author_meta( 'DOB', $user->ID ) ); ?>" class="regular-text" />

    </td>
    </tr>
    <tr>
    <th><label for="mobile">Mobile</label></th>

    <td>
    <input type="text" name="mobile" id="Mobile" value="<?php echo esc_attr( get_the_author_meta( 'Mobile', $user->ID ) ); ?>" class="regular-text" />

    </td>
    </tr>
    <tr>
    <th><label for="Address">Address</label></th>

    <td>
    <input type="text" name="strt" id="strt" value="<?php echo esc_attr( get_the_author_meta( 'Address-street', $user->ID ) ); ?>" class="regular-text" />
    <span>Address 1</span>

    <input type="text" name="addy2" id="addy2" value="<?php echo esc_attr( get_the_author_meta( 'Address-2', $user->ID ) ); ?>" class="regular-text" />
    <span>Address 2</span>

    <input type="text" name="city" id="city" value="<?php echo esc_attr( get_the_author_meta( 'Address-city', $user->ID ) ); ?>" class="regular-text" />
    <span>city</span>

    <input type="text" name="province" id="province" value="<?php echo esc_attr( get_the_author_meta( 'Address-province', $user->ID ) ); ?>" class="regular-text" />
    <span>State/ Province</span>

    <input type="text" name="zip" id="zip" value="<?php echo esc_attr( get_the_author_meta( 'Address-zip', $user->ID ) ); ?>" class="regular-text" />
    <span>Postal / Zip code</span>

    <input type="text" name="country" id="country" value="<?php echo esc_attr( get_the_author_meta( 'Address-country', $user->ID ) ); ?>" class="regular-text" />
    <span>Country</span>

    <input type="text" name="opt" id="opt" value="<?php echo esc_attr( get_the_author_meta( 'OPT', $user->ID ) ); ?>" class="regular-text" />
    <span>OPT</span>
    </td>

    </tr>

    </table>
    <?php }

    /*
    *
    * Populate the form field specifically on the form My Profile (form 3)
    * return RGForms::get_form( 3, false, false, false, $field_values, false, 1);
    *
    */

    function user_profile_shortcode( $atts, $content ){
    global $current_user;
    get_currentuserinfo();

    //UNTESTED
    $meta = get_user_meta( $current_user->id );

    $field_values = array(
    'email' => $current_user->user_email,

    'first_name' => $meta['first_name'][0],
    'last_name' => $meta['last_name'][0],
    'Title' => $meta['Title'][0],
    'Mobile' => $meta['Mobile'][0],
    'DOB' => $meta['DOB'][0],
    'Gender' => $meta['Gender'][0],
    'Address-2' => $meta['Address-2'][0],
    'Address-street' => $meta['Address-street'][0],
    'Address-city' => $meta['Address-city'][0],
    'Address-zip' => $meta['Address-zip'][0],
    'Address-province' => $meta['Address-province'][0],
    'Address-country' => $meta['Address-country'][0],
    'OPT' => $meta['OPT'][0]

    );

    return RGForms::get_form( 3, false, false, false, $field_values, false, 1);

    }
    //[user_profile] Will Display The Form.
    add_shortcode( 'user_profile', 'user_profile_shortcode' );

    Posted 11 years ago on Sunday August 12, 2012 | Permalink
  3. Your urgent request hit us outside normal support hours (which are 9AM to 6PM GMT -0400 Mon-Fri.) Do you still need help with this on Monday?

    Posted 11 years ago on Monday August 13, 2012 | Permalink
  4. Mike_sa
    Member

    got it all sorted out thanks :)

    Yea I thought it would be afterhours for you guys :)
    Was working locally so could not provide a url, but thanks very much for the reply :)

    Posted 11 years ago on Monday August 13, 2012 | Permalink