We were using the LoginWP plugin and redirecting different user roles to different pages after login. However, the user is not being redirected to the correct language page after login.
We have now removed the LoginWP plugin and our developer has added the following code snippet to redirect users to different welcome pages:
function form_login_redirect( $redirect_to, $request, $user ) {
//is there a user to check?
global $user;
if ( isset( $user->roles ) && is_array( $user->roles ) ) {
if ( in_array( 'staff', $user->roles ) ) {
return get_permalink(get_page_by_path("office-dashboard"));
}else if ( in_array( 'subscriber', $user->roles ) ) {
return get_permalink(get_page_by_path("user-dashboard"));
}
}
return $redirect_to;
}
add_filter( 'login_redirect', 'form_login_redirect', 1, 3 );
add_action('wp_logout','ps_redirect_after_logout');
function ps_redirect_after_logout(){
wp_redirect( '/member-login' );
exit();
}
However, it's still not working.
Could you please look into this and provide us with a solution?
The "LoginWP" plugin isn't on our compatibility list (https://wpml.org/plugin/) but you've removed it so that's not in question.
The custom coding support is also out of scope of this forum.
However, since you mentioned you're using Elementor's login widget and we can look into that - as long as it offers the intended purposes (but not working as expected). I am not sure much about it.
Is this possible for you to reproduce the same thing on this fresh Sandbox site hidden link ? Just use the minimal possible setup with simple examples. It is a fresh installation with WPML plugins uploaded (not installed or active). You can upload your theme and plugins here and setup as needed.
You can use this plugin https://wordpress.org/plugins/download-plugins-dashboard/ to enable downloadable links for plugins and themes in Plugins and Themes pages respectively. Then you can upload in the sandbox via Plugins/Themes -> Add New.
Please take your time and reply when the site is ready. Once you are able to reproduce the issue, please write down detailed steps about how one can reproduce the issue on another fresh installation.
The topic ‘[Closed] Elementor – Not redirecting to the correct language after login’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.