Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

BuddyPress Lockdown

By: a guest on Nov 28th, 2011  |  syntax: None  |  size: 0.49 KB  |  views: 2,223  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.  
  3. // **** Privacy ********
  4. function restrict_access(){
  5. global $bp, $bp_unfiltered_uri;
  6.  
  7.         // If user is not logged in and
  8.         if (!is_user_logged_in() &&
  9.                                 (
  10.                                         // The current page is not register or activation
  11.                                         !bp_is_register_page() &&
  12.                                         !bp_is_activation_page()
  13.                                 )
  14.                
  15.                 )       {
  16.                                 // Redirect to registration page. Change /join to your register page slug
  17.                                 bp_core_redirect( get_option('home') . '/join' );
  18.                         }
  19. }
  20.  
  21. add_action( 'wp', 'restrict_access', 3 );
  22.