Group Mods

  • Profile picture of @mercime
  • Profile picture of r-a-y
  • Profile picture of Hugo

[Resolved] Register page as my home page (3 posts)

Started 6 months, 3 weeks ago by: drmikelbrown

  • Profile picture of drmikelbrown drmikelbrown said 6 months, 3 weeks ago:

    Hello All,

    I have seen on websites bp sites where the sites home page is the register page i.e. http://www.mysite.com/register . In reading the forums this weekend I came across posts that suggested that I could accomplish this task with adding custom slugs to the wp-config.php. So I added:


    define ( ‘BP_REGISTER_SLUG’, ‘home’ );

    After clearing my cookies and viewing my site I still have the old index.php for my home page. Am I missing something? Can some one help me please. Thanks

    BTW. My site is wp 3.5.1 bp 1.3 (the one before 1.5)

  • Profile picture of David Carson David Carson said 6 months, 3 weeks ago:

    There are different ways to do this.

    Do you have a bp-custom.php file in your plugins directory?

    http://codex.buddypress.org/extending-buddypress/bp-custom-php/

    If so, try adding this to it:

    // Redirect logged out users viewing homepage to register page.
    function custom_redirect_home_to_register()  {
    global $bp;
    
    	// If user is not logged in and viewing front page
    	if (!is_user_logged_in() && bp_is_front_page() )  {
    				// Redirect to registration page. Change /register to your register page slug
    				bp_core_redirect( get_option('home') . '/register' );
    			}
    }
    
    add_action( 'wp', 'custom_redirect_home_to_register', 3 );

    If not, create the file and include an opening php tag before adding that code. This uses basic conditionals and can be customized however you’d like.

    http://codex.buddypress.org/developer-docs/conditional-template-tags/

  • Profile picture of drmikelbrown drmikelbrown said 6 months, 3 weeks ago:

    @David thanks this worked perfectly. I was trying a bunch of different redirects but I keep getting caught in a redirect loop. Thanks this helped a whole lot.