• I have a problem with the website, once a user posts an ad, an email is automatically sent indicating the ad has been published but it is still in moderation, instead of pending moderation, what could be the problem?

    https://gido.website

    The page I need help with: [log in to see the link]

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

    (@gwin)

    This most likely has to do with this thread https://ww.wp.xz.cn/support/topic/moderate-6/

    Try changing the code to something like that

    
    add_action( "template_redirect", function( $tpl ) {
        if( adverts_request( "_adverts_action" ) != "save" ) {
            return $tpl;
        }
        
        include_once ADVERTS_PATH . "includes/class-shortcode-adverts-add.php";
        
        $shortcode = new Adverts_Shortcode_Adverts_Add();
        $shortcode->load_args_from_checksum();
        $shortcode->init();
        $post_id = $shortcode->get_post_id();
        $post_id_nonce = $shortcode->get_post_id_nonce();
            
        if( $post_id > 0 && ! wp_verify_nonce( $post_id_nonce, "wpadverts-publish-" . $post_id ) ) {
            return $tpl;
        } 
        if( $shortcode->get_post_id() > 0 ) {
            wp_update_post( array(
                "ID" => $shortcode->get_post_id(),
                "post_status" => "pending"
            ) );
        
            if( !is_user_logged_in() && get_post_meta( $post_id, "_adverts_account", true) == 1 ) {
                adverts_create_user_from_post_id( $post_id, true );
            }
            do_action( "wpadverts_advert_saved", $post_id );
    
            wp_redirect( "https://gido.website" );
            exit;
        }
       
        return $tpl;
    } );
    
Viewing 1 replies (of 1 total)

The topic ‘Emails Problem’ is closed to new replies.