- This topic has 2 replies, 3 voices, and was last updated 4 years, 3 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
Affiliates Management Plugin for WordPress
by
WordPress Affiliate Manager › Forums › Affiliate Manager Plugin › Affiliate Login page redirects to wp-admin login page
As explained above !!!
my affiliate login page
its url https://curiouspiyuesh.com/affiliate-home/affiliate-login/
irrespective of username and password it redirects to wpadmin page . kindly help me out solve this
@Revathi, Is it for a successful login? The login redirection won’t work if another plugin overrides the URL: https://wpaffiliatemanager.com/forums/topic/login-redirect-issue-with-pmpro/
I am using WP Affiliate Manager and had this same problem – failed login defaulting to the WordPress login page. I found this snippet online and it worked for me with my theme’s (Divi) login page. With failed login it now stays on the same login page. The only thing I can’t get to work is there is no error message telling the user that the login failed. Anyway, you need to put the snippet it in your theme’s function.php file which is hopefully in a child theme folder. I hope this works for you.
function wpcc_front_end_login_fail( $username ) {
$referrer = $_SERVER[‘HTTP_REFERER’];
if ( !empty( $referrer ) && !strstr( $referrer,’wp-login’ ) && !strstr( $referrer,’wp-admin’ ) ) {
$referrer = esc_url( remove_query_arg( ‘login’, $referrer ) );
wp_redirect( $referrer . ‘?login=failed’ );
exit;
}
}
add_action( ‘wp_login_failed’, ‘wpcc_front_end_login_fail’ );
function custom_authenticate_wpcc( $user, $username, $password ) {
if ( is_wp_error( $user ) && isset( $_SERVER[ ‘HTTP_REFERER’ ] ) && !strpos( $_SERVER[ ‘HTTP_REFERER’ ], ‘wp-admin’ ) && !strpos( $_SERVER[ ‘HTTP_REFERER’ ], ‘wp-login.php’ ) ) {
$referrer = $_SERVER[ ‘HTTP_REFERER’ ];
foreach ( $user->errors as $key => $error ) {
if ( in_array( $key, array( ’empty_password’, ’empty_username’) ) ) {
unset( $user->errors[ $key ] );
$user->errors[ ‘custom_’.$key ] = $error;
}
}
}
return $user;
}
add_filter( ‘authenticate’, ‘custom_authenticate_wpcc’, 31, 3);