Hiding an Element from Other Role Types

Hi,

I have two different role types: Job Seeker and Employer. From the Job Seeker’s profile, I have a switch button that allows them to hide their profile from Employers, which works great. However, the problem is that when a Employer views the Job Seeker’s profile, they are able to see this switch button and actually have permission to hide/show the Job Seeker’s profile for them.

So my question is how can I make it so the container holding the switch button is hidden from Employers but is visible to the logged-in Job Seeker who is viewing their own profile?

Just use the Wix Users API and the getRoles() function to check the role of the logged in user and do if they are Job Seeker role then show the switch button or else hide the button.
https://www.wix.com/corvid/reference/wix-users.User.html#getRoles

See previous posts to get you going.
https://www.wix.com/corvid/forum/community-discussion/showing-certain-data-in-a-collection-to-specific-members-only
https://www.wix.com/corvid/forum/community-discussion/menu-items-based-on-user-role
https://www.wix.com/corvid/forum/community-discussion/show-elements-to-admin-only
https://www.wix.com/corvid/forum/community-discussion/show-a-button-based-on-member-role
https://www.wix.com/corvid/forum/community-discussion/use-role-visitor
https://www.wix.com/corvid/forum/community-discussion/get-the-information-of-user-roles
https://www.wix.com/corvid/forum/community-discussion/urgent-send-a-user-to-location-based-on-member-role

Oh okay great, thank you!