1

Is it possible to allow users to log in with a different role?

For eg. I've one user having two roles one is "Mentor" and second is "Mentee" with different access on the front end.

And now I want to create login where a user can select a role to log in with. If the user will select "Mentor" will able to access all feature this role and vice versa. So a user has to select a role to login so they can access website features according to selected role.

Any help will be appreciated.

2

1 Answer 1

0

When you register a user keep 2 rule as select or radio button, And keep save the rule in the database. also, keep rule option in login, When the login checks the rule and give what access you want to give.

For access keep a condition in top of each page like 'if user rule == ***' else 'You are not allowed to visit the page'

5
  • registration process already completed, User can select any role to at the time of registration but problem with login using different role and give access of only one role Jun 14, 2017 at 11:41
  • it's nothing just keep user information in the session variable. User ID, Name, Rule The check in every page or where you want if the rule match he can access. Jun 14, 2017 at 11:43
  • multiple roles for one user is possible, eg user will be mentor or mentee both but can't access both role feature with same login. If user need to access Mentor feature then need to login with mentor role and same for mentee Jun 14, 2017 at 11:44
  • yes session will be good but I'm looking with wordpress possibility Jun 14, 2017 at 11:46
  • Yes possible, then you have to keep the option to choose multiple rules choose Jun 14, 2017 at 11:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.