Login Form Giving Error
-
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 EARLYThe page I need help with: [log in to see the link]
The topic ‘Login Form Giving Error’ is closed to new replies.