Skip to:
Content

bbPress.org

Opened 10 years ago

Closed 9 years ago

#2809 closed defect (bug) (duplicate)

Reopen 1645/3626: invalid logout redirect

Reported by: evan100's profile Evan100 Owned by:
Milestone: Priority: normal
Severity: normal Version: 2.5.6
Component: General Keywords:
Cc:

Description

When using the logout widget at the top level of the forums, 'bbp_logout_url' correctly generates a logout and redirect of

http://foo.co.uk/wp-login.php?action=logout&_wpnonce=[...]&redirect_to=http://foo.co.uk/forums/?loggedout=true

However, when the user is in the support forum, for example, it incorrectly generates

http://foo.co.uk/wp-login.php?action=logout&_wpnonce=[...]&redirect_to=http://foo.co.uk/forums/forum/support/?loggedout=true

Note the trailing 'forum/support/'. The redirect fails with a 404. This is also true if the user is anywhere else other than the top level - a user profile, for example.

The error is in the line of code changed in https://bbpress.trac.wordpress.org/changeset/3626:

$redirect_to = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];

In my case, 'is_ssl' is false, HTTP_HOST is 'foo.co.uk', URI is 'forums/forum/support', REFERER is 'http://foo.co.uk/forums/', and I have a temporary fix by hardwiring '$redirect_to' (to http://foo.co.uk/forums/).

WP 4.2.2, bbpress 2.5.6, Linux/SL6. I'm not sure of the significance of the 'WP installed in sub-folder' in #1645. In my case, DOCUMENT_ROOT points to the wordpress directory.

Change History (4)

#1 @johnjamesjacoby
10 years ago

I'm failing to see what is wrong with either of the results you've posted. Both the root and single forum URLs look correct to me? Can you detail what exactly you expect should happen, or what isn't happening? Why would a single forum generate a 404 for you?

#2 @Evan100
10 years ago

The first result is Ok. The return value from 'bbp_logout_url' logs you out, and then redirects you to http://foo.co.uk/forums/, which is good.

The second one fails. The return value logs you out, as expected, but then tries to redirect you to where you were when you were logged in: http://foo.co.uk/forums/forum/support. However, that's not possible if you're logged out of a private forum, so you get a 404 instead. Note that http://foo.co.uk/forums/forum/support *is* a valid URL *if you are logged in*.

Sorry, only just realised the significance of public/private forums - new to bbpress.

This ticket was mentioned in Slack in #bbpress by thebrandonallen. View the logs.


10 years ago

#4 @thebrandonallen
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Closing in favor of #2188.

Note: See TracTickets for help on using tickets.