I would like to restrict access to my WP job manager applications add-on, using the function to only allow the developer 'role' to apply for jobs. I added the code found on your Applications: Limiting applications to a certain role, link below;(https://wpjobmanager.com/document/applications-limiting-applications-certain-role/).
As stated in the above link, I added the below code to my site’s application form.php.
At the top of the file add:
<?php if ( current_user_can( 'candidate' ) ) : ?>
I Replace ROLE with my desired role ‘candidate ’.
At the end of the file add:
<?php else : ?>
Please login as a Developer to apply for this position.
<?php endif; ?>
The problem is that this has not blocked the employer from applying for jobs, where it is supposed to bring up the restricted content message; "Please login as a Developer to apply for this position."
I have been doing more testing on the above code with a few different roles to see if this makes a difference,
See the outcome below regarding the different roles and who gets access;
Example 1 - current_user_can (candidate) Candidate role - can access the application function Subscriber role - no access, gets correct message (Please login as a Developer to apply for this position) Employer role - can access the application function
Example 2 - current_user_can (subscriber) Subscriber role - can access the application function Candidate role - - no access, gets correct message (Please login as a Developer to apply for this position) Employer role - can access the application function
Example 3 - current_user_can (employer)
Employer role - can access the application function
Candidate role - - no access, gets correct message (Please login as a Developer to apply for this position)
Subscriber role - no access, gets correct message (Please login as a Developer to apply for this position)
So what I want to find-out why the Employer role can still view the application process on all options? How can I block them from applying for jobs, as they are only supposed to be able to post jobs on the site, not apply.
Looking forward to your response.
Regards;
Greg