Tell us what you are trying to do?
I am developing a system for managing student enrollments in different courses.
I have read these: https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
But it is not exactly what I want to do, since in the example the user must first register to later access and publish content.
What I want is that, through a course registration form, create the user at the same time, storing both the user data and the course to which they have registered.
I started by adding custom fields in User Fields, but then I realized that I can't relate the user I create in WordPress to a custom post.
How could I solve it?
Is there any documentation that you are following?
I have read these: https://toolset.com/course-lesson/how-to-create-custom-searches-and-relationships-for-users/
https://toolset.com/forums/topic/relationship-between-custom-posts-and-users/
Is there a similar example that we can see?
Any web of courses where you can subscribe to
What is the link to your site?
its a local site.
Hello,
There isn't such kind of built-in feature within Toolset Forms plugin.
One user form can handle only one user by default, in your case, you might consider custom codes, for example:
After user registered with the user form, use action hook "cred_save_data" to trigger a custom PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
And in this PHP function, create the new post with PHP function wp_insert_post()
See the custom codes of below tip:
hidden link
Luo, your ideas sound great.
I will try!
thank you!
Lou, I tried the custom PHP function and it worked!
But... I have two new questions:
1- In the user registration form there are 2 different fields that I don't understand: username and nickname. What is the difference between them?
2- When I enter a username that already exists, it doesn't send the form and it doesn't notify that the username already exists. Is there any way to validate it?
According to our support policy, we prefer one ticket one question, I assume the original question of this thread is resolved.
For the other new questions, please check the new ticket here:
https://toolset.com/forums/topic/i-have-two-new-questions/
My issue is resolved now. Thank you!