Skip to:
Content

bbPress.org

Opened 9 years ago

Closed 8 years ago

#1835 closed defect (fixed)

Redirected to forum list after creatiing a reply

Reported by: alexvorn2 Owned by: MZAWeb
Milestone: 2.3 Priority: normal
Severity: normal Version: trunk
Component: Component - Replies Keywords: has-patch
Cc: georgemamadashvili@…, alexvorn2, wordpress@…

Description

When a reply is sent, the topic should be shown not the forum list of topics...

Attachments (1)

1835.diff (1.6 KB) - added by MZAWeb 8 years ago.

Download all attachments as: .zip

Change History (25)

#1 @alexvorn2
9 years ago

This works ok when permalinks are set, but if the Common Settings is set to Default then it is working like described in the ticket.

#2 @Mamaduka
9 years ago

  • Cc georgemamadashvili@… added

#3 @johnjamesjacoby
8 years ago

  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to 2.1

Can't duplicate this on the latest or stable. Do you have specific duplication instructions?

#4 @johnjamesjacoby
8 years ago

  • Keywords needs-patch reporter-feedback removed
  • Milestone 2.1 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Tested with standard permalink formats; confirmed it's working as expected.

Closing pending more specific information.

#5 @alexvorn2
8 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

http://www.screenr.com/XL08 I'm using WP 3.3.2, bbPress r3920

- <input type=”hidden” id=”_wpnonce” name=”_wpnonce” value=”01c15e206b” /><input type=”hidden” name=”_wp_http_referer” value=”/wordpress/?topic=topic-8″ /><input type=”hidden” id=”bbp_redirect_to” name=”redirect_to” value=”http://localhost/wordpress/wp-admin/edit.php?post_type=topic” />
+ <input type=”hidden” id=”_wpnonce” name=”_wpnonce” value=”01c15e206b” /><input type=”hidden” name=”_wp_http_referer” value=”/wordpress/?topic=topic-8″ /><input type=”hidden” id=”bbp_redirect_to” name=”redirect_to” value=”http://localhost/wordpress/?forum=forum1%2F%2F” />

this is what I found comparing the files,
I reopened the ticket...

#6 @alexvorn2
8 years ago

  • Milestone set to 2.1

#7 @johnjamesjacoby
8 years ago

  • Milestone changed from 2.1 to 2.2
  • Priority changed from high to normal

Can you please reply with the following.

  • Is this happening theme-side or admin-side?
  • Can you include your server/bbPress configuration, and duplication steps so I can see what you see?

For reference, the function to troubleshoot is bbp_redirect_to_field(), in bbp-common-template.php.

I'm moving this to 2.2, since it's not a blocker and cannot be reproduced.

#8 @alexvorn2
8 years ago

  • Cc alexvorn2 added

#9 @alexvorn2
8 years ago

this is happening when permalinks are not set...
this is bbPress bug, I can set this on a hosting service so you can log in and test

#10 @alexvorn2
8 years ago

I am using Windows 7 btw

#11 @alexvorn2
8 years ago

	// Rejig the $redirect_to
	if ( !isset( $_SERVER['REDIRECT_URL'] ) || ( !$redirect_to == home_url( $_SERVER['REDIRECT_URL'] ) ) ) {
		$redirect_to = wp_get_referer();
	}

	// Make sure we are directing somewhere
	if ( empty( $redirect_to ) ) {
		$redirect_to = home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' );
	}

if this part of code is removed everything is ok.

some variables:

$redirect_to - http://localhost/wordpress/?topic=topic-1

$_SERVER['REDIRECT_URL'] - null(nothing), should be /index.php

home_url( $_SERVER['REDIRECT_URL'] ) - http://localhost/wordpress, (should be http://localhost/wordpress/index.php)

home_url( isset( $_SERVER['REQUEST_URI'] ) ? $_SERVER['REQUEST_URI'] : '' ) - http://localhost/wordpress/wordpress/?topic=topic-1 (should be http://localhost/wordpress/?topic=topic-1)
Last edited 8 years ago by alexvorn2 (previous) (diff)

#12 @alexvorn2
8 years ago

on linux server everything is ok

#13 @alexvorn2
8 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

#14 @MZAWeb
8 years ago

  • Cc wordpress@… added
  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 2.0 to 2.2

This is still an issue on trunk: http://screencast.com/t/lNiz86Fqsn

#15 @alexvorn2
8 years ago

it's a issue only on windows and mac os, 99% of the sites are on linux, that's why I closed the ticked because it had no attention from someone

#16 @alexvorn2
8 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.2 to 2.3
  • Version changed from 2.2 to trunk

#17 @MZAWeb
8 years ago

On standard permalinks the bbp_redirect_to hidden is being set incorrectly. Looking into it

#18 @MZAWeb
8 years ago

The problem is in http://bbpress.trac.wordpress.org/browser/trunk/includes/common/template-tags.php#L1076

1) $_SERVERREDIRECT_URL? is apache only. And I think depends on configuration.
2) Even if the server meets the requirements, $_SERVERREDIRECT_URL? returns the path after the domain. When permalinks are off, it returns empty, and in that case we're getting wp_get_referer() which I think is not the intended functionality in this case.

But bbp_redirect_to_field is used quite a bit across the code... I'm not sure I totally understand what I will break if I try to patch this.

#19 @MZAWeb
8 years ago

  • Keywords 2nd-opinion added

#20 @johnjamesjacoby
8 years ago

Agree that getting rid of the Apache specific tags is best. The problem is the use of wp_get_referer(), which isn't the correct function here. We don't want to redirect to the referrer, we want to redirect usually back to the current page the user is on. If there's some reason the user doesn't belong there, template_redirect will usually take care of that.

#21 @MZAWeb
8 years ago

  • Keywords 2nd-opinion removed
  • Owner set to MZAWeb
  • Status changed from reopened to new

@MZAWeb
8 years ago

#22 @MZAWeb
8 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

Patch seems to do the trick. Works both with and without permalinks, in apache and nginx. It could use some testing with IE, though.

#23 @alexvorn2
8 years ago

  • Keywords needs-testing removed

for me the patch works too, Windows 7

#24 @johnjamesjacoby
8 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [4533]) Redirect:

  • Rethink the way bbp_redirect_to_field() works.
  • Removes apache specific global checks.
  • Fixes incorrect usage of wp_get_referer().
  • Props MZAWeb.
  • fixes #1835.
Note: See TracTickets for help on using tickets.