[Closed] Set the post author when payment completes

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.


Hi guys good day!

I am trying to:

I'm trying to create form for a product (sponsorship article) with front-end submission with payment.

I've created the form (for creating a sponsorship post) and created a custom role (sponsor) through the access plugin. The reason is that I want to target different roles differently through clear segmentation.

Woocommerce has "customer" as role and Form has "default" or "author" as roles. Now, according to this scenario, I'm limited to choose the role of this product to either author or customer. So there is still a mismatch between the custom role (sponsor) I've created with access and the options presented by form commerce or woocommerce.

Unfortunately, when I reached: (Set the post author when payment completes)

It is not possible to choose from a dropdown or a list my created custom role (sponsor) for this specific "product" instead of this (After payment completes, make the client the author of the post)

If this is not possible at this moment, how can this be achieved programmatically? Do you have any idea how this can be achieved?

Would you consider this option to be implemented soon?

See screen

I look forward to hear back from you asap

Best regards,



Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Hi there

I'm not sure I understand your question.

First let me point out that we have a known issue with user forms in a similar scenario: https://toolset.com/errata/notification-email-is-not-sent-when-completing-an-order-created-by-toolset-forms-commerce/

If your problem is that you have set up post forms to do the same and it is simply not working, then I can test that.

The title of your question is about setting the post author when payment status completes, have you tried that and it is not working?

You write about custom roles, but I'm missing the relevance of this in this particular scenario, if you could elaborate.

Btw, you will be pleased to learn that support for multiple roles is coming soon to Access. In the initial update there will be support for Access rules where users have multiple roles, to cover where other plugins (such as WC Subscriptions) add a role. A subsequent update will also let you set multiple roles within Access itself.


Hi again

My question was simply to be able to set a different role than the one mentioned in the setting of the Edit Form (see screen)

"After payment completes, make the client the author of the post". I want the customer of this product assigned the "sponsor" role that I created with Access

Because, I created a custom role with Access (see screen). And I want after payment completes, make the client the "sponsor" of the post.

I hope it is now clear

Regarding you other questions, I spent a whole day testing but as you mentioned it's useless unless the notification issue with forms commerce is solved which I hope as soon as possible to be able to continue the implementation and test the whole purchase process, see the notification coming and see the whole process in action.

Now the status now is as follow

Edit form: puts the product in cart and redirects to a not found page. Then when I go to cart to proceed with order, I must be logged to check out

hidden link

User form: when I submit the form, it redirects back to the same form, although I set it up for purchasing a product.

hidden link

I followed the guides below for setting up the forms and woocommerce





Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+01:00)

Toolset Forms Commerce serves two purposes, but it sounds like you want a hybrid of the two.

You can use it to charge users to publish content (built on the back of post forms), or you can use it to charge users to register on the site (built on the back of user forms).

When you charge users to register, the form specifies the role they will be given when the process, including payment, completes. Custom roles are available (see screenshot).

But your screenshots and description are of a post form, used to charge users to publish content. There is no place for roles here. What changes as the order progresses through to payment is the status of the post being published. You can optionally specify who the author of the published post will be.

It sounds like you want to update the latter workflow so that not only is the post published when the order completes, but the role of the author of the post is changed to your custom role at the same time.

That's not something which is envisaged, and so would require custom code to set up.

You would use the Forms Commerce API hook cred_commerce_after_order_completed. See https://toolset.com/documentation/programmer-reference/cred-commerce-api/#cred_commerce_after_order_completed

That hook will be triggered when the order status is marked as complete.

You have the user id available in the $data argument.

You can use a function such as wp_update_user to modify the role of an existing user (https://codex.wordpress.org/Function_Reference/wp_update_user).

Is that what you are aiming for? A form to charge payment to publish content which changes the role of the user after payment completes?

The topic ‘[Closed] Set the post author when payment completes’ is closed to new replies.