最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - Public WP website with one area just for members

programmeradmin0浏览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?

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?

Share Improve this question asked Apr 23, 2019 at 19:44 DeeJayDeeJay 1
Add a comment  | 

1 Answer 1

Reset to default 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

发布评论

评论列表(0)

  1. 暂无评论