Skip to:
Content

BuddyPress.org

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#3852 closed defect (bug) (fixed)

Plugin form submits break if not trailingslashed

Reported by: boonebgorges's profile boonebgorges Owned by:
Milestone: 1.6 Priority: major
Severity: normal Version:
Component: Core Keywords:
Cc: sushkov

Description

Some plugins send post requests to non-trailing-slashed (or otherwise non-canonical) URLs. Our new bp_canonical_redirect() sends them on to the correct URL. But this screws up the data sent in the POST request.

(Note that this should only happen for plugins that catch form submits in a screen function. Anyone hooked to bp_actions or bp_screens or even wp will not have the problem. It's only just before the template is loaded that the redirect takes place.)

We can deal with this one of three ways:
1) Before redirecting a non-canonical redirect, check to see whether $_POST has stuff in it. If so, don't redirect - let the URL resolve.
2) Instead of doing a regular redirect, do a wp_remote_post(), with the original POST payload. This is pretty hackish, but possible.
3) Don't do anything. Warn plugin authors on bpdevel, and let them solve it themselves in their plugins by setting their form actions to a proper URL.

I lean towards (1). Other thoughts?

Change History (5)

#1 @sushkov
13 years ago

Thanks a lot Boone for stepping in!
+1 for #1

Version 0, edited 13 years ago by sushkov (next)

#2 @cnorris23
13 years ago

(3) is my top pick, but (1) probably makes the most sense.

If (1) is chosen, I feel like it would it be good to add a _doing_it_wrong() before we let the URL resolve.

#3 @boonebgorges
12 years ago

  • Keywords 2nd-opinion removed

I feel like it would it be good to add a _doing_it_wrong() before we let the URL resolve.

Agreed, but _doing_it_wrong() is marked private, so I'm not going to use it. Maybe in the future we can have our own version of this delightful function.

#4 @boonebgorges
12 years ago

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

(In [5611]) Bail from bp_canonical_redirect() during POST requests, in order to maintain backward compatibility with plugins that submit form requests to non-canonical URIs. Fixes #3852

#5 @sushkov
12 years ago

Nice!
Thank you.

Note: See TracTickets for help on using tickets.