• Resolved nazansari

    (@nazansari)


    WP CROWDFUNDING Plugin: https://ww.wp.xz.cn/plugins/wp-crowdfunding/ doesn’t let the forminator login form to display usual error of Account pending approval. Rather we see error which is: An error occurred while processing the form. Please try again
    (undefined)


    As soon as the WPCROWDFUNDING plugin is disabled, I do see the usual pending approval notice. I have already contacted with WPCROWDFUNDING support & they haven’t responded, can you help?

    NOTE: Already activated/deactivated & done with troubleshooting.
    Using Forminator Register & Wooocommerce Login page, I do see pending message, so I’ve tried editing your PHP File which is in mu-plugin i.e login_non_approved_error, however, still forms show above mentioned undefined error.

    Kindly Help!

    <?php
    /**
    * Unified pending-approval message for ALL login flows (Woo + Forminator).
    * Works for both AJAX (Forminator) and page reload (Woo).
    */

    add_filter( 'authenticate', function( $user, $username, $password ) {

    // If already authenticated, don't change anything.
    if ( $user instanceof WP_User ) {
    return $user;
    }

    $username = trim( (string) $username );
    if ( $username === '' ) {
    return $user;
    }

    global $wpdb;

    // Look for pending in wp_signups (Multisite-compatible; fallback to single prefix).
    $table = $wpdb->base_prefix . 'signups';
    $has = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table ) );
    if ( $has !== $table ) {
    $table = $wpdb->prefix . 'signups';
    $has = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $table ) );
    }

    $is_pending = false;

    if ( $has === $table ) {
    $pending_id = $wpdb->get_var(
    $wpdb->prepare(
    "SELECT signup_id FROM {$table}
    WHERE (user_login = %s OR user_email = %s) AND active = 0
    LIMIT 1",
    $username, $username
    )
    );
    $is_pending = (bool) $pending_id;
    }

    // OPTIONAL: uncomment and adjust if your approval plugin stores status in usermeta
    /*
    $u = get_user_by( 'login', $username ) ?: ( is_email($username) ? get_user_by('email', $username) : null );
    if ( $u && get_user_meta( $u->ID, 'new_user_approve_status', true ) === 'pending' ) {
    $is_pending = true;
    }
    */

    if ( $is_pending ) {
    // Return WP_Error so both Woo and Forminator show this message
    return new WP_Error(
    'not_approved',
    __( '<strong>ERROR</strong>: Your account is still pending approval.' )
    );
    }

    // Not pending? Let normal authentication continue
    return $user;

    }, 1, 3 ); // run EARLY

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support Saurabh – WPMU DEV Support

    (@wpmudev-support7)

    Hello @nazansari

    Hope you’re doing well today!

    I was able to replicate the “An error occurred while processing the form. Please try again
    (undefined)” when using the Forminator login form on my labsite with WPCrowdfunding plugin installed.

    Please note, the snippet that you are using is specifically to customise the error that Forminator shows by default, although I could not notice any issue with the Snippet itself, and the issue was replicated as soon as I installed the WPCrowdfunding Plugin.

    I have escalated this with our developers to take a closer look to see if we can further narrow down the issue on the Forminator side; however, in case the issue relates to the WPCrowdfunding plugin, in that case there is not much we can do on our end.

    In any case, we will keep you posted about it as soon as we receive further updates from our developers.

    Kind Regards.
    Saurabh

    Thread Starter nazansari

    (@nazansari)

    Thanks, Let me know if you need anything from my side, waiting for Developer’s response. Below file will be more helpful for them in resolving the situation:

    WPCROWDFUNDING Plugin > Includes

    public function login_form() { $html = ''; $error = false; $login = ( isset( $_GET['login'] ) ) ? $_GET['login'] : ''; if ( strpos( $login, 'failed' ) !== false ) { $error = true; $html .= '<p class="error"><strong>ERROR:</strong> Invalid username and/or password.</p><br><br>'; } elseif ( strpos( $login, 'empty' ) !== false ) { $error = true; $html .= '<p class="error"><strong>ERROR:</strong> Username or Password is empty.</p><br><br>'; } $html .= '<div class="wpneo_login_form_div" ' . ( $error == false ? 'style="display: none;"' : '' ) . '>'; $html .= wp_login_form( array( 'echo' => false, 'hidden' => true, ) ); $html .= '</div>'; return $html; }
    Plugin Support Jair – WPMU DEV Support

    (@wpmudevsupport15)

    Hello @nazansari

    Thanks for the additional information. I have shared it to our development team for their investigations.

    Kind regards,
    Jair.

    Plugin Support Nebu John – WPMU DEV Support

    (@wpmudevsupport14)

    Hi @nazansari,

    Our development team investigated the reported issue and confirmed that it occurs because the Crowdfunding plugin is interfering with the login process through the following code.

    add_action( 'wp_login_failed', 'wpcf_front_end_login_fail' );  // hook failed login
    function wpcf_front_end_login_fail( $username ) {
    	$referrer = $_SERVER['HTTP_REFERER'];
    	if ( ! empty( $referrer ) && ! strstr( $referrer, 'wp-login' ) && ! strstr( $referrer, 'wp-admin' ) ) {
    		wp_redirect( $referrer . '?login=failed' );
    		exit;
    	}
    }

    Please inform the Crowdfunding plugin support team about this, as it requires a fix within their plugin code.

    Best Regards,
    Nebu John

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @nazansari,

    Since we haven’t heard from you for a while. I’ll mark this thread as resolved for now. Please feel free to re-open this thread if you need any further assistance.

    Kind Regards,

    Nithin

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Login Form Giving Error’ is closed to new replies.