Opened 13 years ago
Closed 13 years ago
#2155 closed defect (bug) (fixed)
Fix Current URL in bbp_redirect_to_field()
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | 2.3 | Priority: | normal |
| Severity: | normal | Version: | 2.2.3 |
| Component: | Tools - Code Improvements | Keywords: | has-patch needs-testing dev-feedback |
| Cc: | alexvornoffice@…, nashwan.doaqan@… |
Description
Hi Guys , I just found this small bug in bbPress ...
bbp_redirect_to_field() Function doesn't work when the WordPress in sub-folder , because of using WordPress home_url() function , bbp_redirect_to_field() can't guess the correct current URL ...
Example :
if current URL is "http://localhost/wp/page" the bbp_redirect_to_field() redirect you to "http://localhost/wp/wp/page" .
Tested On :
WordPess 3.5
bbPress 2.2.3
PHP 5.4.3
Attachments (3)
Change History (19)
#2
follow-up:
↓ 4
@
13 years ago
- Component changed from General to Code Improvement
- Keywords needs-patch added; has-patch removed
- Version changed from trunk to 2.2.3
#4
in reply to:
↑ 2
@
13 years ago
- Keywords has-patch added; needs-patch removed
Replying to alexvorn2:
this patch is not good, because it breaks another fix...
https://bbpress.trac.wordpress.org/attachment/ticket/1835/1835.diff
I have added a patch file that uses wp_get_referer() function :)
#7
in reply to:
↑ 6
@
13 years ago
Replying to alexvorn2:
why not use home_url function?
I describe the problem above , as you see home_url() function returns a the website home link like localhost/bbp , and REQUEST_URL return the URI which was given in order to access this page like /bbp/post-title/
So passing REQUEST_URL to home_url() return wrong URL localhost/bbp/bbp/post-title/
#8
follow-up:
↓ 10
@
13 years ago
what about site_url() function? can you test if it works well here?
#10
in reply to:
↑ 8
@
13 years ago
- Keywords reporter-feedback removed
Replying to alexvorn2:
what about site_url() function? can you test if it works well here?
Remember that site_url() can return the same as home_url() in most cases :)
see :
http://codex.wordpress.org/Function_Reference/site_url
http://codex.wordpress.org/Function_Reference/home_url
#11
follow-up:
↓ 13
@
13 years ago
yeap, but it should work I think...
anyway, there must be a function, not a
$_SERVER['HTTP_HOST']
variable
#13
in reply to:
↑ 11
@
13 years ago
Replying to alexvorn2:
yeap, but it should work I think...
anyway, there must be a function, not a
$_SERVER['HTTP_HOST']variable
there are no must :) , The code I write above is from the WordPress core and bbPress core too , and it writed in many plugins and themes :)
Why are you feel bad of using HTTP_HOST ?!
#15
@
13 years ago
Hi everyone, I thought I would update you on my experience with this problem. I have spent MONTHS finding a reason and a fix for why my bbPress forum would redirect users to random places when replying to a post. I noticed the URL was being rewritten wrongly - see http://bbpress.org/forums/topic/forum-reply-redirect-url-rewrite-issue/#post-125384
Anyway, I implemented the patch that @alex-ye added and my replies were redirected correctly! Am very relieved and thankful :)
My WordPress was setup on Windows 7/IIS 7.5/PHP 5.3/MySQL 5.1 with the latest version of WordPress and bbPress.
related #1835,
this patch is not good, because it breaks another fix...
https://bbpress.trac.wordpress.org/attachment/ticket/1835/1835.diff