[Résolu] Change the user role on form's submission
This support ticket is created Il y a 3 années et 7 mois. 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.
I have a forms that is linked to a WC product thanks to a specific custom field integrated inside the form.
The form is published as soon as the product is paid.
Now, I need to change the role of the user that have created the new post and don't know which hook I need to use for that.
Can you helps please?
Regards
Pat
It seems that our chat was disconnected so I've moved the conversation to this support ticket so that you can share any update or a follow-up question.
You're welcome to reach us through a new ticket anytime, for a different question or concern.
During our conversation, you proposed to use cred_commerce_after_order_completed
I just want to be sure that this will cover my case. Here some additional explanations :
I have a postype (Adhesion) and have created a Toolset Form to create a post in the frontend. This form is a WC form and I have inside a radio field that is used to define the product that will be associated to the buying process.
As soon as a user validate the form, the post is created and the related product is added to the cart. This part is fully working.
Now, I need to add a hook in order to change the user's role (the user that have created the post) depending of the product he has chosen in the form. I have this hook currently and it is working fine but I have placed it as a cred_save_data which change the role as soon as the form is validated.
What I need is :
1. to make the post published when payment is made (done thanks to the standard WC / Toolset process)
2. to change the user role when the order is completed (either by a payment or by a manual action in the WordPress admin).