404 page redirect for non logged in users
-
When a user is not logged in my forums/forum/___ pages redirect to a 404 page. Is there a way to have them directed to a login page instead?
Thank you for your time.
Take care,
Kari
-
Does anyone reply to these forums?
Hi Kari,
With both the weekend and a major community summit, the past few days have been pretty slow around here.
This is a hard question to answer, because it depends on your forums and how you have them setup as private.
There are also security implications to consider. For example, if your forums are only for logged in users, redirecting to a login page vs. showing a 404 hints to hackers that something exists vs. it not existing, which incentivizes the hunt.
I usually try to recommend that forums use the login widgets, or otherwise have some always-available login form to use instead. That way private forums can still 404 for non-logged-in users, without the redirect hint.
If you do want to redirect anyways, you’ll need a custom plugin to modify the way bbPress works.
Unhook
bbp_forum_enforce_private
andbbp_forum_enforce_hidden
, and write your own equivalent functions to usebbp_redirect()
rather thanbbp_set_404()
.Ok. I guess there are folks responding… All I am wondering is if there is supposed to be a redirect when someone isn’t logged in. I want to prevent non logged-in users from viewing this 404 page because it has a list of all the pages within my website, and I need to keep that accessible only to logged-in users.
Oh sorry! I must have been sending this message at the same time as your response. I understand. That you for taking the time to respond. I had submitted a couple questions a long time ago that hadn’t been answered and was worried this forum wasn’t monitored. Anyway will read your response now thank you!!
Okay. The 404 page redirect does make sense then I didn’t think about it that way. Do you know where I can modify the redirect page so that it only shows the 404 page not found message and not a list of my site’s pages? Thanks again.
if there is supposed to be a redirect when someone isn’t logged in
No. When inaccessible pages are requested, a 404 is returned.
I want to prevent non logged-in users from viewing this 404 page because it has a list of all the pages within my website, and I need to keep that accessible only to logged-in users.
I’ve created a Trac ticket to get more development discussion on the idea here:
Do you know where I can modify the redirect page so that it only shows the 404 page not found message and not a list of my site’s pages
It usually depends on the theme, but
404.php
is a good start. It probably has some function or functions that put out a sitemap, but that’s just a guess, and every sitemap type plugin is different.In addition to bbPress, there are legitimate Membership plugins that are better equipped to handle things like private pages or members-only sections of websites. If you haven’t used any, Restrict Content Pro and Paid Memberships Pro are good ones.
Ok great!! I will definitely check these plugins out. You’ve helped me a ton with these responses and I really appreciate it! I will be sure to follow up on that ticket submission you made as well. Thanks a bunch!!! 🙂
Take care,
Kari
- You must be logged in to reply to this topic.