Hello,
I have a questionnaire post type that ends up suggesting woocommerce products.
I am currently using 2 forms: first one creates the user, second one creates the post.
My client wants to switch these steps so that the user email/name/password are created at the end not the start.
Is there any workaround? I don't mind creating a "fake" temporary user, assign him as the author of the post, but then how can I change email/password at the end of the second form?
I would also want to avoid switching these fields to user fields...
If you can suggest a better way I'll be more than happy.
Thanks
Hello,
It needs custom codes, for example:
one post form for creating new post + one user form for creating new user:
1) After you submit the post form, the post author is your self, and redirect to the new post
2) In this post content, display the user form, in this user form, output a hidden generic field, field value is current post ID,
https://toolset.com/documentation/programmer-reference/forms/cred-shortcodes/#cred_generic_field
After you fill and submit the user form, send the email, and use action hook cred_save_data to trigger a PHP function:
https://toolset.com/documentation/programmer-reference/cred-api/#cred_save_data
In this PHP function, get the hidden generic field post ID value
hidden link
and update the post author to the new user:
https://developer.wordpress.org/reference/functions/wp_update_post/