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.
Hi David,
Thank you for contacting us and I'd be happy to assist.
I'm afraid, there is no built-in feature available which can be used to create a post automatically when a user is created through a front-end form.
To achieve this, you'll need to include some custom code to insert a new post in your desired post type, through a hook "cred_save_data" ( ref: https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data ), which is fired when a front-end form is submitted.
You'll find a relevant example snippet for a similar requirement, in this reply:
https://toolset.com/forums/topic/creating-a-custom-post-type-with-cred-and-user-registration-at-the-same-time/#post-1182310
I hope this helps and please let me know if you need any further assistance around this.
regards,
Waqar
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.
You can collect the data for these fields inside the user form, through generic fields.
( ref: https://toolset.com/course-lesson/adding-generic-fields-to-forms/ )
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.