I have a form used to create a support ticket on site. This form collects basic user information. We would like to allow for user registration, so that this information doesn’t need to be entered by the customer each time. I have installed the User Registration Add-On, but that seems like it redirects to a different page when the standard registration is accessed.
Is it possible to set up a form so that when the user info is entered, users have the option of creating an account when the form is submitted. If the user is logged in when returning to the same form, their “stored” information is auto populated into the form.
Be sure you have created a page on your site to hold your custom registration form, and then you have selected this page on the “User Registration Settings” page:
Yes. Create a User Registration feed to “Create User” when the form is submitted. You can use conditional logic on this based on a question in the form (“Create an account?”) so that the user is registered only if they have indicated they want to create an account. That will register them for your site. On the feed, you map the form fields to user meta fields, so the data they submit to you is stored in their profile.
Now, when they come back to your site, you can use another form and a User Registration feed to “Update User”. When you map the form fields to the user profile fields, the information from their profile will pre-populate the form with information from their profile.
If you just want a few items from their profile to fill in fields in the form, you can use the user meta merge tags as “Default value” for any fields in the form. The user meta merge tags are documented here:
This is a big help. The first thing is, do I need a form for ONLY user registration, which is specified as the Custom Registration page? Really, there is not going to be a need to have a form for only registration… users would only register on this form if they would like an account created.
You don’t NEED a form for registration only. People can register on your site via the normal method. The User Registration add-on allows you to collect more data from them, to store in your profile. It sounds like in your scenario, you do need a custom registration page because people will sometimes want an account created. You can use that page for the custom registration form, and then NOT register them, based on the conditional logic settings on your User Registration “Create User” feed. You will have to try some things and see what works best for you.
I got it all working, I think. Some points and further questions:
I added the Registration Feed (Create User) to the main form I am using. I am presenting a question on whether to register or not. Is there a way to provide login fields right on the form itself where you can login and not leave the current page?
I used the {user:user_login} to see if the user is already logged in or not.
I used some other WP code to change the URL of the Edit Profile link in the Admin Bar to go to another form which Updates the user. Also redirects to this page after a non directed login… although I don’t have any other links to login.
Used the “redirect_to” in the wp_login.php URL to provide a link to login if a user is not and wants to login, and bring them back to the form after.
Is there any ability to have the same form create a user OR update user data if a checkbox is checked for “Update Profile Data?” I see you can’t have a Create and Update feed on the same form… but why? Seems like you could have update be an open but REQUIRE a field to specify when to use update over create.
The User Registration add-on requires one form for the Update feed and a different one for the Register feed. However, this add-on might able to let you do it all with one form:
Thanks for the suggestions. On using an AJAX plugin (and others), is there a way to use shortcodes for other plugins within HTML fields for Gravity Forms, such as in form description and HTML blocks?
That will not work in your form because you just embedded a form within a form. As I said, it’s up to the shortcode whether or not it works. Even if it were parsed it would not function correctly in the HTML field. You’ll need to find another approach.