[Gelöst] Creating a Profile CPT at the same time as a user is registering
This support ticket is created vor 3 Jahre, 2 Monate. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Tell us what you are trying to do? Membership site - I need to create a Custom Post Type containing various information about the member - specialties, cities served, etc. The front end of my site determines which type of membership the user is signing up for, and the signup form is specific to that type of membership (some fields are available on one form, other fields on another form. It looks like this:
Click on "Basic Member" -> display "Basic Member" form -> create User and Custom Post Type "Profile"
Click on "Premium Member" -> display "Premium Member" form -> Payment -> create User and Customer Post Type "Profile'
Is there any documentation that you are following? I've looked through the forms and haven't found anything that helps. Selecting the right form isn't the issue -- creating the new user and a corresponding custom profile is.
No link to current site, I'm building a sandbox site now, but I've looked at this problem before with no luck. I would use custom user fields, but views doesn't let me build a select form for custom fields.
To be clear --
1) create custom user fields, then
2) create the same fields in a custom post type (e.g. "User Profile"), then
3) create a User Form for new user registration (and for maintenance too, I would assume), then
4) use cred_save_data to add/update the "User Profile" from the User fields
Is this the correct flow?
Your understanding and the workflow is correct, but I'd like to add some improvements and explanation:
1) create custom user fields, then
- You don't need to create custom user fields, as the actual fields data needs to be saved with the "User Profile" post type.
The generic fields data will be available as part of the form's submission to be processed in step 4, but won't be saved as a duplicate (user fields).
2) create the same fields in a custom post type (e.g. "User Profile"), then
- Yes
3) create a User Form for new user registration (and for maintenance too, I would assume), then
- Yes
4) use cred_save_data to add/update the "User Profile" from the User fields
- To clarify, the user form will be the only form a user will be submitting at the time of registration. It will consist of necessary user fields like name, email, password, etc, and the generic fields for the data needed for the custom fields of "User Profile" post type.
When the form will be submitted, the user will be created by this form and through the custom function linked to the "cred_save_data" hook, a new post will be inserted into the "User Profile" post type. The generic fields data will also be saved into that newly inserted "User Profile" post's relevant custom fields.
My issue is resolved now. Thank you! I would think this topic would be worthy of a more complete tutorial. I had some trouble with identifying fields (not Toolset's fault, but mine), but we're good now. There was not reference to "meta_input", but luckily it was mentioned in something I had read.