users login error

Contact Visitors and Signup are some of the pages available to visitors (not logged in). When users log in from any of these pages they get error since membership blocks them from these pages when they are logged in.

"Sorry, we can't find the content you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you'd like to go."

How can I redirect them to a page of my choice? If possible without a plugin. Trying to keep them at a minimum.

Just fyi, all users only log in using the bp-daily login page seen below (site/wp-login.php). There are no buddypress admin menus available to them.

  • Mason

    Hiya drdave,

    I've used the following in a php file in my mu-plugins folder to redirect any attempt to access the default signup page to the homepage:
    <?php
    function mj_block_wp_signup() {
    if( strpos( $_SERVER['SCRIPT_NAME'], 'wp-signup.php' ) !== false ) {
    wp_redirect( get_option('siteurl') );
    die;
    }
    }
    add_action('wp', 'mj_block_wp_signup', 99);
    ?>

    That will work, if you're wanting them to login via the homepage, if it's a different page then you can adjust the wp_redirect to the page of your choice.

    Hope this helps!

    Thanks!

  • Mason

    Hiya drdave,

    Sorry for the delay, it appears I missed this one.

    I guess I'm still a bit unsure of what you want to do. Are you saying that when a visitor logs in on a page, they sometimes get a 404 because they no longer have access to that page as a signed in user?

    If you're using the membership plugin, they should be redirected to your 'no access' page not a 404. If not, I'm not sure why or how you're making a page only available to strangers. Explain a bit more and I'll see if I can provide a better solution. Why not just give them access to these pages once they're logged in?

    Thanks!

  • drdave

    Are you saying that when a visitor logs in on a page, they sometimes get a 404 because they no longer have access to that page as a signed in user?

    Yes but not the 404 error though but an error nonetheless.

    Here is a scenario.

    A user arrive at the site (not logged in). Of course they have access to Home - About - Contact -Visitors at the stranger level (not logged in).

    They then decide to visit the contact page. From the contact page they login. Now they get the error...

    "Sorry, we can't find the content you're looking for at this URL. Please try selecting a menu item from above or to the side of this message to get where you'd like to go."

    My assumption is that since this contact page is not in my membership positive rules (just a page I made available for strangers only) is why they get the error.

    If they are on the contact page, once logged in they end up on the contact page. If they are on the home page same thing, they login and they arrive at the home page. Both these pages are in positive rules so no problem there.

    How do i fix this? They get this error for signup, visitors and contact only. Home and About pages are fine. I rather them redirected to the home page for those pages once logged in.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.