Support » Plugin: WPAdverts - Classifieds Plugin » Enforce ad moderation after Paypal payment

  • Resolved Matt Biscay

    (@skyminds)


    Hi Greg,

    We need to make sure all adverts get approved by an admin after they have been paid for (Paypal payment) before they are published on site.

    In a previous thread, you mentioned removing this filter in an init action:
    remove_action('adverts_payment_completed', "adext_payment_completed_publish");

    It’s not ideal as the ad status shows “pending payment” even though payment has already been received. Is there a way to set it as ‘pending’ or ‘draft’ so then the admin can review and publish it?

    Thank you,
    Matt

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    you can add the code below in your theme functions.php file

    
    add_action( "adverts_payment_completed", function( $payment ) {
      if( adverts_request( "action" ) == "adext_paypal_standard_notify" && $payment->post_status == "completed" ) {
        $object_id = get_post_meta( $payment->ID, "_adverts_object_id", true );
        wp_update_post( array(
          "ID" => $object_id,
          "post_status" => "draft"
        ));
      }
    }, 5000 );
    

    This should change Ad status to draft when the payment is marked as completed by PayPal IPN integration.

    Thread Starter Matt Biscay

    (@skyminds)

    Hi Greg,

    Thanks for the code, I’ll test it shortly.

    Shall I keep the remove_action('adverts_payment_completed', "adext_payment_completed_publish"); filter or does the new snippet supersedes it ?

    Thanks,
    Matt

    Plugin Author Greg Winiarski

    (@gwin)

    Yes, you would need to keep the old snippet as well.

    Hello, I just bought your extension and I am interested in the same question ask above,
    In function.php, what is the function as modify to be able to moderate premium ads?
    Thank you in advance

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    it depends on how you are charging the users for posting new Ads? If you are using WooCommerce integration then you can enable moderation from wp-admin / Classifieds / Options / WooCommerce panel.

    If you are using the default Payments module then using the code above should work for you.

    OK, I thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Enforce ad moderation after Paypal payment’ is closed to new replies.