Applications: Limiting applications to a certain role

← Back to Applications

Please note: All code examples and plugin suggestions are provided for reference or guidance only, and we cannot guarantee that they will always work as expected. Our support policy does not include assistance with modifying or debugging code from any code examples, or providing support for any suggested 3rd-party plugins.

A common request is to limit the actual application form to a certain user role. This is possible with a small amount of customisation, as follows:

1. Override the Template File

Copy the plugin file wp-job-manager-applications/templates/application-form.php to YOURTHEME/wp-job-manager-applications/application-form.php. The version you copy to your theme will take priority.

2. Edit the Template File

Inside your newly copied file, you can use the current_user_can function to check if a user can apply.

At the top of the file add:

<?php if ( current_user_can( 'ROLE' ) ) : ?>

Replace ROLE with your desired role or capability, for example, ‘subscriber’.

At the end of the file add:

<?php else : ?>
Custom content here shown to users without access.
<?php endif; ?>

The application form will now only be visible to the users with permission.

Note: According to the WordPress codex on the current_user_can function, “While checking against particular roles in place of a capability is supported in part, this practice is discouraged as it may produce unreliable results.”, so we cannot guarantee that this custom code will always work as expected.

Applications Documentation