• Resolved Jeff Sterup

    (@foomagoo)


    Any user can submit jobs when they access the page with the submit_job_form shortcode. I’ve checked the box to require an account but that just requires an account with any role. How do I limit it to the employer role or admins?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Gunther Joksch

    (@katschi01)

    I had the same problem and found out that jobmanager doesn’t offer this feature. I solved the problem with the plugin If Menu – Visibility control for Menus. But it probably also works with the Page Restriction WordPress plugin

    Thread Starter Jeff Sterup

    (@foomagoo)

    This seems like basic functionality that should just be an option on the settings page but I was able to achieve restricting users who can post jobs by using two filters. This plugin does a really good job of offering a lot of filters and actions to achieve a lot of things. So that is good I guess. This function restricts posting jobs to users who can edit posts and the employer role.

    add_filter('job_manager_user_can_post_job', 'restrict_job_posting', 10, 1);
    add_filter('job_manager_user_can_submit_job_listing', 'restrict_job_posting', 10, 1);
    
    function restrict_job_posting($canPost) {
    	$currentUser = wp_get_current_user();
    	if (!in_array('employer', $currentUser->roles) && !current_user_can('edit_posts')) {
    		$canPost = false;
    	}
    	return $canPost;
    }
    
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Any user can submit jobs’ is closed to new replies.