Skip to:
Content
Pages
Categories
Search
Top
Bottom

Member Only Theme

  • I was looking at other people’s solutions for making a buddypress community member only and really came to one conclusion. It will be best served when the components are added :) That being said, I was looking at the seriously easy hacks due to the high volume of SVN updates being made. The simple one I was looking at was doing the following in /buddypress-member/header.php right at the top of the file :

    <?php if(!is_user_logged_in()){

    nocache_headers();
    header("HTTP/1.1 302 Moved Temporarily");
    header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
    header("Status: 302 Moved Temporarily");
    exit();

    } ?>

    Just putting that at the top of the file would redirect any request to buddypress-member theme back to the login page if not logged in. While there are most likely better ways to do this, I was looking for a simple one copy and paste type edit when things change.

    My questions about this are:

    1) Is there a more efficient way to do this without multiple hacks to multiple files?

    2) If this is a good way, is there an easy method to add the text “You must login to view member profiles” to the login that I am redirecting to as well as a link to the wp-signup.php page?

    Trent

Viewing 8 replies - 1 through 8 (of 8 total)
  • You could write a small plugin that used the login_head action. You could put something on the querystring that the plugin would looks for.

    Hmm….never really thought about that since I was thinking any plugin would apply to all the themes, but using the right template calls if the statements would work really well wouldn’t it. Thanks for the tip Ron. Usually the simplest solution is right in front of you :)

    Trent

    Check out dsader’s privacy plugin at wpmudev.org. He did it in that.

    Awesome, Trent…simple and quick! I had wondered about this, as I want more sign-ups for my site and thought this might would work…

    I used “/wp-signup.php?redirect_to=” so people would more than likely sign-up.

    thanks!

    Might have to throw this into a little plugin now since it is more stable. I hopefully can get that done here pretty soon as more people are interested in this :)

    Trent

    Avatar of Maagic-net
    maagic-net
    Participant

    @maagic-net

    Any news about this?

    Actually, yes! I created a small little plugin to force member login to see member profiles. I was going to put it on groups as well, but my members wanted groups that are public to be just that, public. There is already an option to make a group private anyways.

    http://buddypress.org/forums/topic.php?id=481

    Trent

    Avatar of John James Jacoby
    John James Jacoby
    Keymaster

    @johnjamesjacoby

    Thanks for this. Will be a good patch until the real privacy settings come about.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Member Only Theme’ is closed to new replies.