We are having issues with our login form. We currently have two user roles set up: Client and Legal Professional. Each of these user roles have different access groups configured.
Both user types are using the same login form. Here is the code for the login form:
[wpv-conditional if="('[wpv-current-user info='id']' eq '')"]
Login
[wpv-login-form]
Forgot Password?
[wpv-forgot-password-form]
[/wpv-conditional]
[wpv-conditional evaluate="false" if="('[wpv-current-user info='id']' eq '')"]
You are logged in.
[/wpv-conditional]
When a user logins, the site should redirect them to the appropriate dashboard (/wp/client/dashboard) OR (/wp/legal-professional/dashboard). Here is the code being used for the redirect:
Currently, the site always redirects the user to /wp/legal-professional/dashboard, regardless of the user type. The Client user role does not have access to this page, so they are shown the 404 page.
I can’t find the setting or problem that is redirecting all users to the same URL. Any help is greatly appreciated. Thanks.
Thanks Shane. That helps, but it still isn't redirecting to the correct URL. The $user = wp_get_current_user(); line seems to be necessary, because now that I have that added, every login is redirecting to the homepage (found in the else brackets). Therefore, I'm thinking the code used to specify user roles is not working correctly. I checked the slugs (see attached) and everything appears to be correct.
I wasn't sure where to add the if statement that you provided, and if I would be doing that for every user role (administrator, legal professional, & client).
Thanks for this information. The first block of code works. As for the second block of code, the legal professional role is redirecting to the correct location, but the client user role does not redirect to the correct location. When I login as a client, I am redirected to /wp/legal-professional/dashboard when I should be redirected to /wp/client/dashboard.