WordPress.org

Support

Support » How-To and Troubleshooting » Members Only Site

Members Only Site

  • I have setup four websites using WordPress to-date. The users for these sites wanted static sites that they could have pages describing their business and posts for recent news about their business – so the only login was for their own admin.

    I am working on a new site (collecting content) that will be for a class that the client will be teaching. They want to add the individuals as a user so that they are allowed to login, but not see the dashboard, but view the static pages (several subjects) that the curriculum is in. I f they don’t login, they can’t see curriculum.

    Is there a way to do this with a user that is just a subscriber?

    Any assistance is appreciated.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Adrian

    @adrianfraguela

    Yes this is possible.

    To login and not be directed to the dashboard do the following:

    For the login form – Codex explanation

    <?php
        $args = array("redirect" => "/your-desired-url");
        wp_login_form($args);
    ?>

    And then to check if a user is logged in you can do this:

    <?php
    if ( is_user_logged_in() && current_user_can('subscriber') ) {
        echo 'Welcome, registered user!';
    } else {
        echo 'Welcome, visitor!';
    }
    ?>

    This checks to see that the user is logged in and also a subscriber.

    Adrian,

    Thank you for the assistance – it is very much appreciated.

    I will give this a try when I finish collecting all the content and setup a small test site.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Members Only Site’ is closed to new replies.