• Resolved Margriet

    (@margrietburorader)


    Hi,

    Does the Members plugin also work for the content type Projects? I made a workbook for my clients and have indicated that only logged in users can see the content by adding a role and by indicating on the project ‘modification’ page that this content can only be seen by logged in users with this role.

    When going to a project page and filling out the login details, I am redirected to the WordPress dashboard even if I give in the URL of the project page after having been logged in?

    Am I missing something?

    Many thanks,
    Margriet

    • This topic was modified 2 years, 11 months ago by Margriet.

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Plugin Author Caseproof LLC

    (@caseproof)

    Hi Margriet,

    Did you use Content Permissions feature to protect Project Modification page? If that’s correct, and if that didn’t work you can use this custom code and modify it a little bit to protect specific page for role:

    add_action( 'template_redirect', function() {
      // Redirect users from specific page
      // when user doesn't have particular role
      $user = wp_get_current_user();
      if ( is_page('projects') && ( ! is_user_logged_in() || ( ! empty($user) && in_array( 'author', (array) $user->roles ) ) ) ) {
        $redirect = 'https://your-domain.com/wp-login.php'; // Change this to the correct URL
        wp_redirect( $redirect );
        exit;
      }
    } );

    I hope that helps.

Viewing 1 replies (of 1 total)

The topic ‘Does plugin work for project content type?’ is closed to new replies.