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.

custom profile page possible?

  1. mwillenbrink
    Member

    Know you don't have out of the box capabilities for a custom profile page, and have seen how to pre-populate some of the basic profile fields, but is it possible to use GF to create a form, have those fields pre-populated with a logged in user's data, and then have it write back to that user's account?

    This is a great tool, and have most of the pieces doing what I need- this is just the last one!

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  2. Yes, it is possible. There have been people that have implemented functionality like this on sites. It isn't something it does out of the box but you can certainly pre-populate fields with existing data and then customize what happens to the data after the form is submitted and overwrite existing data rather than creating new data.

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  3. mwillenbrink
    Member

    Great- can you point me in right direction to the documentation on how/where to find the hooks to do this?

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  4. There isn't a single document or tutorial that currently covers this entire process. It's made up of a bunch of different moving pieces.

    If you are populating a form with existing user data you would have to dynamically populate the necessary form fields with the values you want to populate them with. You do this just like you would anytime you are dynamically populating form fields. There are several tutorials on how to dynamically populate fields here:

    http://www.gravityhelp.com/documentation/page/How_To

    The main piece of this is when the form is submitted. You then have to use hooks to take the data that is submitted and update whatever data you are updating. If this is a profile and you are updating user data, then you have to use hooks to get the field values and then update the user meta data for that user.

    If you are using Gravity Forms v1.6 beta you would use the gform_after_submission hook which is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_after_submission

    If you are using an older version of Gravity Forms you would use the gform_post_submission hook which is documented here:

    http://www.gravityhelp.com/documentation/page/Gform_post_submission

    After you use these hooks to read the values and update the existing data you would then have to decide if you want to keep the entry that was created automatically by them submitting the form. If you are just updating user meta profile data, chances are you don't want to keep the entry.

    If you want to delete the entry then you have to do this using hooks. There is a forum post that discusses this here:

    http://www.gravityhelp.com/forums/topic/purposefully-not-save-form-in-entries-database#post-15601

    Note in that forum post it uses the gform_post_submission hook but if you are using Gravity Forms v1.6 you would want to use the gform_after_submission hook to do the same thing.

    So what you want to do is actually 3 separate pieces that you have to put together to accomplish having a form that is dynamically populated with user profile data and then when submitted it updates that data.

    Posted 12 years ago on Wednesday September 21, 2011 | Permalink
  5. mwillenbrink
    Member

    Great start! Thanks!

    Posted 12 years ago on Tuesday September 27, 2011 | Permalink
  6. mwillenbrink
    Member

    Sorry to keep asking questions- is there an easy way to find the specific names of the fields/ID's, aside of going in to the database, that GF creates to store data in? Also, if I do have to go in to the database, what table is user meta data, such as address, stored in? Thanks.

    Posted 12 years ago on Tuesday September 27, 2011 | Permalink
  7. Yes, you can view source and get the field id when viewing the form on a page.

    The field id's are used in the HTML for the inputs. This is necessary on fields that consist of more than one input such as the Address Field which is made up of multiple inputs, each one having it's own id off the parent field id.

    Gravity Forms v1.6, which is stable but still considered a test release, also displays the Field ID in the form editor when you hover over a field when editing your form. Here is an example, the new UI displays both the type of field it is and it's ID: http://i.imgur.com/L44Y0.png

    But for fields like the Address Field you would still need to view the HTML and get the individual input id's.

    Posted 12 years ago on Tuesday September 27, 2011 | Permalink

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