[buddypress-trac] [BuddyPress] #2074: wp-login is not part of $bp->root_components

buddypress-trac at lists.automattic.com buddypress-trac at lists.automattic.com
Fri Feb 26 09:05:44 UTC 2010


#2074: wp-login is not part of $bp->root_components
----------------------+-----------------------------------------------------
Reporter:  andrew_s1  |       Owner:       
    Type:  defect     |      Status:  new  
Priority:  minor      |   Milestone:  1.2.2
Keywords:  has-patch  |  
----------------------+-----------------------------------------------------

Comment(by andrew_s1):

 small revision to disable the wordpress hook (the backup plan) if
 buddypress is active, because we don't need it

 <?php
 /*
 Plugin Name: BuddyPress Lockdown
 Plugin URI: http://buddypress.org/
 Description: Lock down your BuddyPress site if a user is not logged in.
 Author: Andy Peatling & Andrew_S1
 Version: 1.3
 Author URI: http://buddypress.org/
 Site Wide Only: true
 */

 function bp_lockdown() {
   global $bp;
   remove_action('send_headers', 'wp_lockdown');

   if ( BP_REGISTER_SLUG != $bp->current_component &&
       BP_LOGIN_SLUG != $bp->current_component &&
       BP_LOGIN1_SLUG != $bp->current_component &&
       !is_user_logged_in() ) {
     bp_core_redirect( site_url( BP_LOGIN_SLUG ) );
   }
 }
 function wp_lockdown() {
   if ( !is_user_logged_in() ) {
     auth_redirect( 'wp-login.php' );
   }
 }

 add_action( 'bp_init', 'bp_lockdown');
 // if no buddypress, have a backup plan
 add_action( 'send_headers', 'wp_lockdown');
 ?>

-- 
Ticket URL: <https://trac.buddypress.org/ticket/2074#comment:4>
BuddyPress <http://buddypress.org/>
BuddyPress


More information about the buddypress-trac mailing list