Skip Navigation

[Resolved] Pending review autocomplete post by CRED Commerce

This thread is resolved. Here is a description of the problem and solution.

Problem: I have used CRED Commerce to create a new post set to "Pending Review" status. When the order is complete, the post should change to "Published" status, but this is not happening.

Solution: WooCommerce made a change that introduced a bug in CRED Commerce. The latest versions of CRED Commerce and WooCommerce include the fix for this bug. Please update to the latest versions of CRED Commerce and WooCommerce.

Relevant Documentation: https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/

This support ticket is created 7 years, 4 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Tagged: 

This topic contains 15 replies, has 3 voices.

Last updated by Bochnacki 7 years, 3 months ago.

Assisted by: Christian Cox.

Author
Posts
#544042

What can I do to post a status change from "pending review" to "complete" after order completion?
I tried to do it in several ways, but my PHP knowledge is too small to be able to do it ...
One of the tests:

add_action('cred_commerce_after_order_completed', 'my_save_data_action',10,1);
function my_save_data_action($data)
{
    $data = array(
         'cred_form_id' => $form_id,
         'cred_post_id' => $post_id,
    );
    update_post_status( 'completed', $data );
}

I will be grateful for help.

#544049
Screen Shot 2017-07-02 at 5.23.19 PM.png

Hi, do I understand you correctly?
- You want to change the post status of the post created by CRED
- You want this change to happen when the order is completed
- You want to change the status to 'published'

If this is all correct, then you do not need PHP:
https://toolset.com/documentation/user-guides/using-cred-commerce-to-add-payments-to-forms/
You can select a standard post status in your CRED Commerce settings for a CRED Commerce form. However, your comment indicates you want to use the post status 'completed'. This is not a standard WordPress post status, and would need to be registered as a custom post status. Have you registered this custom post status somehow, or was this unintentional?
https://codex.wordpress.org/Function_Reference/register_post_status

#544204
cred-settings.jpg

On screen "cred-settings.jpg" I show my settings.
The problem is that as I already have completed the order, the post created using the CRED form is still "Pending review".
I can not set the "Status of content created or edited by this form:" to "Pubished" because the post then appears before it is paid. So I have to use PHP.

Thank you for explaining the "status" issue in PHP. However, I still do not know how to properly write it. Can you help me?

#544328

The problem is that as I already have completed the order, the post created using the CRED form is still "Pending review".
That's strange, the status of the post should update to "Published" based on the settings in your CRED form. If that is not the case, then I would like to help fix this issue. You shouldn't need to use PHP. First, please comment out this action hook so this code isn't running when the order is completed:

// add_action('cred_commerce_after_order_completed', 'my_save_data_action',10,1);

- Create a new order with the CRED Commerce form.
- What payment system or gateway are you using?
- How is the order status updated to "complete"?
- Are you using any extra WooCommerce extensions or other plugins to automatically set the order status to "completed" based on some other criteria?
- If you use the "check" or "cash on delivery" payment gateway, then manually complete an order from the WooCommerce Orders screen, does the CRED post's status update correctly?

#544364

I commented out

// add_action('cred_commerce_after_order_completed', 'my_save_data_action',10,1);

- Extra WooCommerce extensions I do not use.
- For now, I do not use any payment system. Ultimately it will be a Polish system but I can not install it yet. For now I use "check" or "cash on delivery" payment gateway.
- The automatic completion of the order I have now done with the code (currently commented out):

add_action( 'woocommerce_thankyou', 'custom_woocommerce_auto_complete_order' );
function custom_woocommerce_auto_complete_order( $order_id ) { 
    if ( ! $order_id ) {
        return;
    }
    $order = wc_get_order( $order_id );
    $order->update_status( 'completed' );
}

Indifferent whether my code to complete the order works, whether it is commented and manually approve the order - post added using CRED form still remains "Pending review".
So it is wrong anyway.

#544376

Okay may I take a look in your wp-admin area so I can see why this isn't working as expected? I will enable a private reply area here.

#544800

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

Christian is currently unavailable due today but will be back on Wednesday to check in on this ticket.

Thanks,
Shane

#544806

Hi.
Thanks for the information.

#545353

Hi, I've been working on this today and I can't understand why it isn't working as expected. I believe there may be a bug, so I'm reaching out to some other team members for assistance. Please stand by and I will update you when I have some more information about the publishing problem.

#545631

Hi, our developers have released a patch for this issue:
https://toolset.com/errata/cred-commerce-is-not-working-properly-with-woocommerce-3-1-0/

The permanent fix will be included in the next release of CRED Commerce. Please download the patch file and install it on your server to resolve the issue where post status is not updated appropriately when the order is completed.

#545652

I can not do test page (I already wrote about it in xxx).
I changed the file according to the instructions. Unfortunately, no change. Post still remain "Pending Review".

When will the next release of CRED Commerce?

#554388

A beta version of CRED Commerce 1.5 is now available for testing in the account downloads area. I do not have a timeline for the full release, but typically it occurs within a week or two following a beta release.

#554817

The official release of CRED Commerce is now available for you in the account downloads area. Please install this new version and confirm that post status changes are being triggered correctly when the user completes payment.

#555022

Thanks for the information.
In reference to thread https://toolset.com/forums/topic/package-number-of-ads-allowed-problem/#post-545908
Does it mean that WC can also update to the latest version?

#555257

That is correct, the new CRED release will work best with WC 3.1.1.