• Resolved thecreator01

    (@thecreator01)


    Hello, I manually approve user registrations, but when a user who creates a registration and is waiting for approval in forminator tries to log in, he encounters the “email address or password is incorrect” warning. Yes, this may be the expected behavior of WordPress, but it would be great if a user who has already created a registration and is waiting for approval encounters a warning like “Your account is waiting for approval” in the login form when he logs in.

    Is there a feature for this in Forminator? Or any solution?

Viewing 3 replies - 16 through 18 (of 18 total)
  • Plugin Support Zafer – WPMU DEV Support

    (@wpmudevsupport15)

    Hi again @thecreator01,

    Please rename both plugins to .bak instead of .php to deactivate them and create a new one and try the following code.

    <?php
    add_action( 'wp_login_failed', 'wpmu_non_approved_login_error', 11, 2 );
    function wpmu_non_approved_login_error( $username, $error ) {
    // Check if the provided username is valid
    if ( !validate_username( $username ) ) {
    $error->errors = array( 'invalid_username' => array('<strong>Error:</strong> Invalid username provided.' ) );
    return;
    }

    // Login failed, so let's check username or email in signups table
    global $wpdb;
    $value = $wpdb->get_var( $wpdb->prepare(
    "SELECT signup_id FROM {$wpdb->prefix}signups WHERE user_login = %s OR user_email = %s", $username, $username ) );

    // Check if the user is in the signups table and not yet approved
    if ($value) {
    $error->errors = array( 'not_approved' => array('<strong>Error:</strong> Your account is waiting for approval.' ) );
    } else {
    // User is not in signups table, show default incorrect password error message
    $error->errors = array( 'incorrect_password' => array('<strong>Error:</strong> The password you entered for the username ' . $username . ' is incorrect.' ) );
    }
    }

    I hope this helps for both conditions.

    Kind regards,
    Zafer

    Thread Starter thecreator01

    (@thecreator01)

    Hi, there has been no change @wpmudevsupport15

    Hello @thecreator01,

    I hope things are going well for you.

    I have checked my test site with the script, which shows the same results. For example, when an Approved user tries to log in with an incorrect password, the script appears with the message: "Your account is waiting for approval."

    I took a consultation from the second-level support team; they have checked on this, and due to the complexity of the request, I’m afraid this will be outside the scope of support we can provide.

    For that, you’ll need to hire a developer so they can provide the required custom code. WordPress provides a jobs directory here: https://jobs.wordpress.net/. If you need further advice about it, feel free to email [email protected].

    Subject: ATTN: WPMU DEV support - wp.org”


    Thanks & Kind Regards,
    Imran Khan

Viewing 3 replies - 16 through 18 (of 18 total)
  • You must be logged in to reply to this topic.