Skip to:
Content
Pages
Categories
Search
Top
Bottom

Private BP without a plugin

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

  • modemlooper
    Moderator

    @modemlooper

    function bp_communituy_redirect() {
    
    	if( !is_user_logged_in() && $_SERVER['REQUEST_URI'] != '/community/' && !is_home() ) { 	
    		wp_redirect( get_option('siteurl') . '/community/'  ); exit;
    	}
    		
    }
    add_filter( 'get_header','bp_communituy_redirect', 1 );
    

    EE
    Participant

    @ericaeide

    Does this go in functions.php or bp-custom.php?


    EE
    Participant

    @ericaeide

    `Warning: Cannot modify header information – headers already sent by (output started at /home/content/56/9819056/html/wp-content/themes/parallelus-salutation/design.php:1) in /home/content/56/9819056/html/wp-includes/pluggable.php on line 876


    modemlooper
    Moderator

    @modemlooper

    Custom page templates will break whenever you add a filter to get_header because of the page template header info. This is really not a BuddyPress issue. There are other ways to redirect the page but they will work just like any plugin. The reason they maybe slow to redirect is because they redirect after page load so you are waiting on header and content.

    Try this, add code to bp-custom.php but not the add filter line, then in header.php before anything else add:

    <?php bp_communituy_redirect(); ?>


    EE
    Participant

    @ericaeide

    `###############################################################################################
    #
    # Looking for the header content? You’ll find it inside “header-default.php”
    #
    ###############################################################################################

    /* This page does nothing. It exists for custom template files and plugins that load content
    * outside the theme structure using direct calls to “the_header()” and “the_footer()”.
    * You should not add anything to this file. If you want to modify header functions or layouts
    * please look at “header-default.php” or “design-header.php”
    */

    ?>

    header.php contains that, so I tried in design-header.php which loaded a blank page, and header-default.php got the same error message… (by the way, I DO appreciate your help!) I just don’t think it should be this hard… I really don’t want to go back to having all groups be private and all members having to change their profile privacy settings 🙁


    modemlooper
    Moderator

    @modemlooper

    like I said all that header info breaks page when you try to do a redirect before page load. You can always do a javascript redirect but that is after page load and not any faster than using one of the plugins. You maybe able to remove the header comment text.


    EE
    Participant

    @ericaeide

    @modemlooper, thanks again for your help. I know nothing about javascript so I’ll keep my fingers crossed I don’t run into any issues with the plugin in the future! 🙂


    bp-help
    Participant

    @bphelp

    @ericaeide
    Have you tested the plugin with all other plugins other than BP and bbPress deactivated because it works pretty sweet for me and I am not just saying it because it is my plugin? When I say deactivate all but BuddyPress and bbPress it means all and not just the ones you choose to leave activated. This is basic troubleshooting procedures!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Private BP without a plugin’ is closed to new replies.
Skip to toolbar