admin管理员组文章数量:1125063
I am using Careerfy Theme for wordpress which is basically a job board and has Candidate and Employer User roles set for new registrations. I want registered users to be able to switch between these roles via link in the menu. Please can someone help me if that will be possible and how can it be achieved. Thank you.
I am using Careerfy Theme for wordpress which is basically a job board and has Candidate and Employer User roles set for new registrations. I want registered users to be able to switch between these roles via link in the menu. Please can someone help me if that will be possible and how can it be achieved. Thank you.
Share Improve this question asked Feb 11, 2024 at 7:22 Job Hunt CommunityJob Hunt Community 1 2- You'll have to ask the Careerfy Theme development or support - this is a third-party theme and has it's own structure and nuance. – Tony Djukic Commented Feb 14, 2024 at 16:04
- Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Bot Commented Feb 14, 2024 at 16:04
1 Answer
Reset to default 0Lets say you are logged in as "Candidate" and if you want to switch to "Employer" , you should then create a new user record with employer role and keep the candidate user_id in employer usermeta table as "switch_user_id"
Suppose that candidate user_id is 4 and if you switch it will first check if "switch_user_id" exist or not, if not then it will create a new user with employer role. For this this newly created employer you should also store "switch_user_id".
So now if you try to switch then get the switch_user_id , logout the current user and login to the other user id.
wp_users
id | user_email | username ...
4 | [email protected] | candidate
5 | [email protected] | candidate_gmail_com
wp_usermeta
user_id | meta_key | meta_value
4 | switch_user_id | 5
5 | switch_user_id | 4
本文标签: How to allow users in wordpress to switch between two assigned roles eg Candidate amp Employer
版权声明:本文标题:How to allow users in wordpress to switch between two assigned roles e.g. Candidate & Employer 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736654450a1946218.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论