Plugin: Force Login for Member Pages
-
***Update**** The one that works for member profiles and groups at http://buddypress.org/forums/topic.php?id=481&replies=18#post-11886
I see there are some people looking for some basic privacy on their BP installs. I am working on one to protect all things off the member-theme, this one at least stops member pages from being viewed and if you are not logged in, sends you to the register page.
Copy the following and create a file called force-member-login.php and place in your /mu-plugins/ folder.
<?php
/*
Plugin Name: Force Member Login
Description: No one can see your member pages unless they are logged in.
Plugin URI: http://trentadams.ca
Author: Trent Adams
Author URI: http://trentadams.ca
Version: 0.1
*/
function force_member_login_init() {
global $bp, $is_member_page;
if ( $is_member_page ) {
if ( !is_user_logged_in() ) {
nocache_headers();
header("HTTP/1.1 302 Moved Temporarily");
header('Location: ' . get_settings('siteurl') . '/register');
header("Status: 302 Moved Temporarily");
exit();
}
}
}
add_action( 'init', 'force_member_login_init' );
?>Let me know if you have any corrections, additions or just plain bug fixes for it
Trent
- The topic ‘Plugin: Force Login for Member Pages’ is closed to new replies.