404 error when user clicks on email message link (not logged in)
-
When a user is not logged in, and they try to click on an email link “Go to the discussion”, they are taken to a 404 page.
Is it possible for the user to be directed to the login page instead, and then once logged in redirected to the original URL?
Seems like something obvious I would have thought?
Thanks,
Chris.
-
What you could do is use something like https://wordpress.org/plugins/all-404-redirect-to-homepage/ and configure that to redirect ll 404’s to the login page.
I’m facing the same issue. It was working fine with earlier versions of BuddyPress, but now when you click “Go to the discussion” link in the email, it redirects to the 404 page.
BuddyPress Version 3.1.0 (latest version)
Can this be resolved within BuddyPress by adding a hook in functions.php or buddypress-functions.php file? Don’t really want to install a redirect plugin, as we still need a 404 page to show.
Thanks,
ErikWhat’s the attempted link that users are clicking on from their email?
You can remove the website domain for privacy.
Someone reported an issue involving 404s that might be related to this forum thread.
To those experiencing 404s with custom profile or group subnav pages, can you try the following fix?
https://buddypress.trac.wordpress.org/attachment/ticket/7931/7931.01.patchURL in the email says:
http://domain-name.com/members/demo2/bp-messages/?thread_id=43If you are logged in an you click on this link, it works fine and takes you straight to the conversation, but if you are not logged in an click it, it just takes you to the 404 page instead.
Applied the patch, but it does not solve the problem.
Is
bp-messages/?thread_id=43
created from a custom plugin? If so, which one? I don’t recognize that URL structure.There’s a plugin called “BP Better Messages”
The problem is with BP Better Messages:
https://wordpress.org/support/topic/404-if-user-isnt-logged-in/I tested the plugin in BP v2.9.4 and v3.1.0 and when not logged in, the link 404s and doesn’t redirect either way.
A way to fix this is if the plugin added a subnav at this line:
https://plugins.trac.wordpress.org/browser/bp-better-messages/trunk/inc/component.php#L170// Add the subnav items to the profile. $sub_nav[] = array( 'name' => 'Inbox', 'slug' => 'inbox', 'parent_url' => trailingslashit( bp_displayed_user_domain() . $this->slug ), 'parent_slug' => $this->slug, 'screen_function' => array( $this, 'set_screen' ), 'position' => 10, 'user_has_access' => bp_is_my_profile() );
Or BP Better Messages could write their own redirector code if the user isn’t logged in.
You are my hero @r-a-y
Thanks for this, it worked! Just tested clicking the “Go to the discussion” link in the email when not logged in and it successfully redirected me to the login page instead of 404 page.
Hi there everyone.
Thansk @r-a-y, i will test this and include in next version of plugin.
Thanks. This code above works at me too.
- You must be logged in to reply to this topic.