618 pointsLike some sort of WPMU DEV God"I'm new here
drdave
Member
—
28th December 2010 (1 year ago)
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.
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.
10635 pointsLike some sort of WPMU DEV GodMindblowingly helpful memberLifetime member
Sales & Support Lead
—
29th December 2010 (1 year ago)
#
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.
Hey masonjames they may be login in from any of several pages since bp-daily places the login on all pages and that is also fine by me. I rather them not go hunting for the login page. Any chance of me adjusting this and if so how?
Currently I have home, about, contact, visitors, signup all of which offer login option.
10635 pointsLike some sort of WPMU DEV GodMindblowingly helpful memberLifetime member
Sales & Support Lead
—
5th January 2011 (1 year ago)
#
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?
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.
Responses (4)
Sales & Support Lead — 29th December 2010 (1 year ago) #
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:
<?phpfunction 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!
Member — 29th December 2010 (1 year ago) #
Hey masonjames they may be login in from any of several pages since bp-daily places the login on all pages and that is also fine by me. I rather them not go hunting for the login page. Any chance of me adjusting this and if so how?
Currently I have home, about, contact, visitors, signup all of which offer login option.
Sales & Support Lead — 5th January 2011 (1 year ago) #
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!
Member — 5th January 2011 (1 year ago) #
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.
Become a member