0

I want to create public WordPress website (for a sports club), but with one closed area just for the members.

The public part of the site will have the usual pages: club info, photo gallery, contact page...

The closed site area:

  • will have access thru login page (as page added in the menu / navigation)
  • a member must type the username and password in order to login
  • after the login, each member can see only one page (page created just for him / her, with info related to them (text, photo...)
  • after the review of the personalized page, the member can log-out (or "the system" can do it in (for example) 30 minutes)

Can I achieve all described above thru WP user roles, or with any free or paid plugin?

1 Answer 1

0

Yes, there are tons of plugins to realize this. In my opinion, the most reliable, streamlined and bugfree plugin is "members" by Justin Tadlock.

As I've said, there are hundrets if not thousands of plugins which can do this. Just browse the plugin directory.

On the other hand, building some custom redirects is not that hard. You could add a redirect filter via

<?php
    /**
    * Redirect user after successful login.
    *
    * @param string $redirect_to URL to redirect to.
    * @param string $request URL the user is coming from.
    * @param object $user Logged user's data.
    * @return string
    */

    function my_login_redirect( $redirect_to, $request, $user ) {
       //is there a user to check?
       if (isset($user->roles) && is_array($user->roles)) {
       //check for subscribers
       if (in_array('subscriber', $user->roles)) {
        // redirect them to another URL, in this case, the homepage 
        $redirect_to =  home_url(); // Change this to page id for example
       }
    }
    return $redirect_to;
 }

 add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );

?>

Please keep in mind that this is just a shot in the dark (copied from codex) and not a full solution. See: Codex Link

1
  • Thank you for the info and suggestions! I'll browse the WP plugin directory for more.
    – DeeJay
    Commented Apr 26, 2019 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.