Skip to:
Content
Pages
Categories
Search
Top
Bottom

Setting redirect page for non-logged in users

  • Avatar of Miko
    Miko
    Participant

    @mikosoft

    I’m new to BP and am trying to set up redirects for non-logged in users. I don’t want them to go to the Register page or the WP login page, as the community is private. I have asked on the plugin forum for Private Buddypress but no reply and I think there may be an easy way to do this but not sure exactly what to put in the PHP code. All I need to know is how to make the below point to a page in my theme folder rather than the WP login:

    `wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php?redirect_to=’ . $redirect_to);`

    I am guessing I change siteurl to something else but what?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Avatar of danbpfr
    danbpfr
    Participant

    @chouf1

    In other words, you need a landing page for visitors.
    Create a new page from within admin
    Then admin settings “read” and the select the appropriate option
    Select also the page you created
    In addition, you can also create a template just for this page.

    Anyway, by default, when arriving on a BP site, anybody is non logged in. Why do you want to redirect in this case ?

    Avatar of Miko
    Miko
    Participant

    @mikosoft

    I don’t want a landing page for visitors, I want normal visitors to see all of the usual pages & posts on the public part of the site. This is happening fine. What I want is for them to arrive on a nice page if they search for something that is on a hidden private part of the site. I am using Private Buddypress to hide members area (private profiles, forums etc) from the main marketing pages of the site ( WP pages and posts). The Private Buddypress plugin annoyingly redirects to the standard WP login screen (as you can see in the code from that plugin posted in my original Q). I do not like this, because it gives no explanantion to the user why they searched for something and arrived at a login screen. This is why I want to redirect to my custom 404 page, which I have modified to say that the item they are looking for is not found, or it is only visible to logged in members. What I want to know is how EXACTLY to modify the above code to get the redirect to point to the 404 page.

    The login screen is not helpful, and in fact it’s offputting/confusing because you have to be a member of our photo club to be allowed into the community – so we don’t accept public registrations. Showing a login screen makes it seem like people should be able to register somehow, when they can’t.

    Avatar of Miko
    Miko
    Participant

    @mikosoft

    I should say that I have already tried simply replacing wp-login.php for something else – even going so far as to make a special page to sit in the same root as wp-login.php but each time I resulted in an infinite loop which meant you couldn’t see ANY of the site without logging in.

    Avatar of Miko
    Miko
    Participant

    @mikosoft

    In case anyone else has the same issue, I switched to BuddyPress Private Community pluign and that seems to sort everything out fine.

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

You must be logged in to reply to this topic.