Skip to:
Content
Pages
Categories
Search
Top
Bottom

Redirect logged out users to a custom login page

  • @nicky112

    Participant

    Hi !

    I am new to buddypress and I am trying to figure out if it fits my needs. So far it looks amazing but I ran into a problem while individualising it. I’ve created a custom login page and I want to redirect all logged-out users to it.

    The problem I ran into is that there a pages on which I don’t want to redirect users. Such pages like registration and activation for example. What worked for me here is that I used bp_is_register_page() and bp_is_activation_page() to check against those but I also need to be able to check against custom pages.

    I figured out that those functions mentioned above use bp_is_current_component(). I thought about creating or registrating my own component to be able to check against but I did not figure out how that works.

    Any help would be appreciated.

    Cheers, nicky

Viewing 3 replies - 1 through 3 (of 3 total)
  • @valuser

    Participant

    Perhaps have a look at http://buddydev.com/plugins/bpdev-logout-redirect/

    it MAY be of some help !

    @valuser

    Participant

    sorry – misread your post

    how about this (found on this forum)

    function sh_walled_garden() {
       if( bp_is_register_page() || bp_is_activation_page())
          return;
       if( ! bp_is_blog_page() && ! is_user_logged_in() )
          bp_core_redirect( bp_get_signup_page() );
    }
    add_action( 'wp_loaded', 'sh_walled_garden' );

    Edit as required
    if i haven’t misunderstood again !!!!!!

    @nicky112

    Participant

    Thanks, bp_is_blog_page() seems to be exactly what I was looking for. Meanwhile I wrote my own function to determine the active page but I’ll give bp_is_blog_page() a try. Let’s see if it fits.

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Redirect logged out users to a custom login page’ is closed to new replies.
Skip to toolbar