Tagged: 

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1363
    raheb9
    Participant

    Hello, I am working on a Job Portal wherein, after a candidate logs in, I can disable the ‘post a Job’ page. And if the employer logs in, I can disable the ‘Post a Resume’ page.

    I have also purchased the Pro plugin just moments ago but am a bit confused.

    My site: jobs.anoc.ae

    #1364
    raheb9
    Participant

    Hi, I tried activating & using Content View Restrictions. Set the Action: Prohibit Access for Role: candidate.
    It successfully blocks the page (post a job) for the candidate role. However, even when I log out and act as Public/Viewer, I cannot access the page ‘Post a Job). I also do not see a role as Public in the Roles List. Please advise.

    #1365
    Vladimir
    Keymaster

    Hi,
    If you set any view restriction for the post, that becomes unavailable for public visitors or not logged in users. In other case a user with role ‘candidate’ may log out and easy post a job as not logged in user.
    I suppose that not logged in users should not have right to send as job, as resume at your site.

    #1366
    raheb9
    Participant

    Yes you are right, but my theme functionality is, if you click on Post a job or Add Resume button on home page, it will take you to login page. Any option where we can create a Public/Viewer user role?

    #1367
    Vladimir
    Keymaster

    In order to have a role, a user should login 1st. Not logged in user can not have any role.
    As home page is available to the public I offer you replace those links for not logged in users with the registration/login links.
    And add a filter for automatic redirection after login to the restricted page according to the assigned role. Like this:

    add_filter('login_redirect', 'redirect_user_after_login', 10, 3);
    function redirect_user_after_login($redirect_to, $request, $user) {
        
        if (isset( $user->allcaps ) && is_array( $user->allcaps )) {
            //check for admins
            if (!empty($user->allcaps['administrator'])) {
                // redirect them to the default place
                return $redirect_to;
            } else if (!empty($user->allcaps['candidate'])) {
                $redirect_to = home_url() .'/post-resume';
            } else if (!empty($user->allcaps['employer'])) {
                $redirect_to = home_url() .'/post-job';
            } else {                                                                                            
                return home_url();
            }
        } else {
            return $redirect_to;
        }   
    }
    
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.