Login problem in forms of userPro plugin

I’ve installed a translated version of userPro plugin on my site. Users can sign-up using userPro forms but they could not login in userPro login forms and they are promoted for wrong user name and password with the exact translation for message The password you entered is incorrect.

Using the same credentials users are able to login to original WordPress login page of my site located under http://example.com/wp-login.php which means there is nothing wrong with signup process.

The file that checks form inside usePro plugin is located under /wp-content/plugins/userpro/functions/ajax.php and the code snippet in charge of login control is as below inside userpro_process_form function. Can you tell me why users cannot login?

/* login */
case ‘login’:
global $wp_filter;
$username_or_email = $form[‘username_or_email’];
$output[‘error’] = ”;

/* remember me */
if (!isset($form[‘rememberme’])) {
$rememberme = false;
} else {
$rememberme = true;
}

if (!$username_or_email){
$output[‘error’][‘username_or_email’] = __(‘You should provide your email or username.’,’userpro’);
}
if (!$form[‘user_pass’]){
$output[‘error’][‘user_pass’] = __(‘You should provide your password.’,’userpro’);
}

if (email_exists($username_or_email)) {
$user = get_user_by(’email’, $username_or_email);
$username_or_email = $user->user_login;
}

/* Form validation */
/* Here you can process custom “errors” before proceeding */
$output[‘error’] = apply_filters(‘userpro_login_validation’, $output[‘error’], $form);

if (empty($output[‘error’]) && $username_or_email && $form[‘user_pass’]) {

$creds = array();
$creds[‘user_login’] = $username_or_email;
$creds[‘user_password’] = $form[‘user_pass’];
$creds[‘remember’] = $rememberme;
$wp_login_hook_arr = array();
$wp_login_hook_arr = $wp_filter[‘wp_login’];
remove_all_actions(‘wp_login’);
$user = wp_signon( $creds, false );
foreach($wp_login_hook_arr as $key=>$value)
{
foreach($value as $wp_login_hook)
{
add_action(‘wp_login’,$wp_login_hook[‘function’],$key,$wp_login_hook[‘accepted_args’]);
}
}
if ( is_wp_error($user) ) {

if ( $user->get_error_code() == ‘invalid_email’ || $user->get_error_code() == ‘invalid_username’) {
$output[‘error’][‘username_or_email’] = __(‘Invalid email or username entered’,’userpro’);
} elseif ( $user->get_error_code() == ‘incorrect_password’) {
$output[‘error’][‘user_pass’] = __(‘The password you entered is incorrect’,’userpro’);
}
} else {

/* check the account is active first */
if ($userpro->is_pending( $user->ID )) {
$uppayment=get_option(‘userpro_payment’);
if (userpro_get_option(‘users_approve’) === ‘2’) {

if($uppayment[‘userpro_payment_option’]==’y’)
{
$output[‘custom_message’] = ‘<div class=”userpro-message userpro-message-ajax”><p>’.__(‘Your email is pending verification/Payment is Pending. Please activate your account.’,’userpro’).'</p></div>’;
}
else
{

$output[‘custom_message’] = ‘<div class=”userpro-message userpro-message-ajax”><p>’.__(‘Your email is pending verification. Please activate your account.’,’userpro’).'</p></div>’;
}
} else {

if($uppayment[‘userpro_payment_option’]==’y’)
{
$output[‘custom_message’] = ‘<div class=”userpro-message userpro-message-ajax”><p>’.__(‘Your account is currently being reviewed/Payment is Pending. Thanks for your patience.’,’userpro’).'</p></div>’;

}
else
{
$output[‘custom_message’] = ‘<div class=”userpro-message userpro-message-ajax”><p>’.__(‘Your account is currently being reviewed. Thanks for your patience.’,’userpro’).'</p></div>’;
}}
wp_logout();

} else {

/* a good login */
userpro_auto_login( $user->user_login, $rememberme );

if (isset($form[‘force_redirect_uri’]) && !empty($form[‘force_redirect_uri’]) && $form[‘force_redirect_uri’]!=0) {
$output[‘redirect_uri’] = ‘refresh’;

} else {

if (current_user_can(‘manage_options’) && userpro_get_option(‘show_admin_after_login’) ) {
$output[‘redirect_uri’] = admin_url();
} else {

if (isset($form[‘redirect_uri’]) && !empty($form[‘redirect_uri’]) ) {
$output[‘redirect_uri’] = wp_validate_redirect($form[‘redirect_uri’]);
} else {
if (userpro_get_option(‘after_login’) == ‘no_redirect’){
$output[‘redirect_uri’] = ‘refresh’;
}
if (userpro_get_option(‘after_login’) == ‘profile’){
$output[‘redirect_uri’] = $userpro->permalink();
}
}
}

/* hook the redirect URI */
$output[‘redirect_uri’] = apply_filters(‘userpro_login_redirect’, $output[‘redirect_uri’]);

}

/* super redirection */
if (isset($form[‘global_redirect’])){
$output[‘redirect_uri’] = wp_validate_redirect($form[‘global_redirect’]);
}

} // active/pending

}

}

break;

Read more here:: Login problem in forms of userPro plugin

Leave a Reply

Your email address will not be published. Required fields are marked *