• Resolved mashour06

    (@mashour06)


    Hello,
    I found the feature to moderate newly created ads before publishing an awesome one. but I found that edited ads gets published without moderation. Is there any way to moderated edited ads?
    Thanks in advance.

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

    (@gwin)

    Hi,
    you can add the code below in your theme functions.php file, it will change the Ad status to pending after editing it from the page with [adverts_manage] shortcode

    
    add_filter( "adverts_sh_manage_list_statuses", function( $s ) {
        $s[] = "pending";
        return $s;
    } );
    add_action( "adverts_post_save", function( $form, $post_id ) {
        if( adverts_request( "_adverts_action" ) == "update" ) {
            wp_update_post( array( 
                "ID" => $post_id,
                "post_status" => "pending"
            ) );
            wp_mail( get_option( "admin_email" ), "Ad pending moderation", sprint( "Ad %d requires moderation", $post_id ) );
        }
    }, 10, 2 );
    

    It will also send an email to the administrator to notify him about a pending Ad.

    Thread Starter mashour06

    (@mashour06)

    Works perfectly, thank you very much.

    Hello,
    I use OceanWP theme and I tried to add this code to functions.php but it does not work.
    I do not know in which section should I paste it?

    Fatal error: Uncaught Error: Call to undefined function sprint()
    Thanks in advance.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    there is a typo in the code i posted, replace “sprint” with “sprintf” it should work fine then.

    Hi,

    Thank you! It works fine.

    With best!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Moderate edited ads before publishing’ is closed to new replies.