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.

saving data from forms for users

  1. I have seen articles touching on this topic, but I haven't seen my specific issue discussed or a similar one resolved so I thought I might ask...
    I am trying to set up a user driven site that captures user information and then auto fills their information into other forms on the site.
    I have the user registration add-on. When the user fills out the registration form, it saves fields that I can use to dynamically populate other forms. If the user didn't fill out their address when registering but enters it later in the "Contact Us" form, for example, is it possible to save it to their user profile? I tried to set up the contact us form as a feed for the user registration plugin, but it requires a username submission, and from what I understand from forum posts up to now, the user registration add on will only create new users; it can't be used to update user information. I found a discussion about this from a year ago on the forum. Any progress/updates?

    Posted 11 years ago on Saturday July 14, 2012 | Permalink
  2. You can use any form you like to collect information and use that to update anything on the site at all. This involves using the hooks which are built in to Gravity Forms to pre-fill the form with data you have (gform_pre_render) and then update the data which is stored in the user profile (usermeta) or anywhere else (gform_after_submission). It's all possible but will require some work on your part to make it happen. It's all fairly straightforward PHP and WordPress programming.

    Posted 11 years ago on Sunday July 15, 2012 | Permalink
  3. Any chance you can give me an example of what that might look like?
    I need to save my "Company" custom user meta field into a user meta field named "acM_s2member_custom_fields"

    Posted 11 years ago on Sunday July 15, 2012 | Permalink
  4. I read forum posts from a year ago mentioning that the developer of the user registration add-on was going to work on creating a user profile update form, so that you could set up a gravity form for the user to edit their profile information. Where does this sit?

    Posted 11 years ago on Sunday July 15, 2012 | Permalink
  5. Can you link to that post please? I will try to find out for you.

    Posted 11 years ago on Sunday July 15, 2012 | Permalink
  6. I am trying this code to save the form submission data to the user_meta table, but it doesn't work. Any advice?

    function set_s2_user_company($entry, $form){
    	global $current_user;
    	get_currentuserinfo();
    	$s2comp = get_user_field ("Company");
    	if ($s2comp == '') { update_user_option($current_user->user_ID, 'acM_s2member_custom_fields', $entry['6']);  }
    }
    add_action("gform_post_submission", "set_s2_user_company", 10, 2);

    I used code from http://www.0to5blog.com/creative/gravity-forms-submitting-forms-to-3rd-party-applications/ to find the ID of my "Country" field that I want to save into "acM_s2member_custom_fields" in the user_meta table.

    get_user_field is a function of s2member. I've used it here, so it should work:

    // populate the field with "company" as the population parameter with the "Company" of the current user
    function env_populate_company() {
    	$s2comp = get_user_field ("Company");
    	if ($s2comp == '') { $value = populate_usermeta('Company'); }
    	else { $value = $s2comp; }
    	return $value;
    }
    add_filter('gform_field_value_Company', 'env_populate_company');

    As for the forum post on enabling existing user to update their info, it's:
    http://www.gravityhelp.com/forums/topic/any-update-on-the-registration-add-on-to-support-already-registered-users

    Posted 11 years ago on Sunday July 15, 2012 | Permalink
  7. Can we start with the basics? What does this variable contain after your function runs? Can you echo the value to the screen or log it or email it to your self?

    $s2comp

    We need to see first if that is working.

    Posted 11 years ago on Monday July 16, 2012 | Permalink