Opened 8 years ago
Closed 7 years ago
#3030 closed defect (bug) (fixed)
'action' for reply form should be more specific
Reported by: | boonebgorges | Owned by: | johnjamesjacoby |
---|---|---|---|
Milestone: | 2.6 | Priority: | high |
Severity: | normal | Version: | |
Component: | Extend - BuddyPress | Keywords: | commit |
Cc: |
Description
form-reply.php uses the_permalink()
to populate the 'action' parameter. This is causing problems for me on a client site.
In a case where the forum appears in a BuddyPress group, the_permalink()
refers to BP's pseudo-page, as set up by its group theme-compatibilty layer. As such, the page ID is 0, and get_permalink()
returns false. In the context of replies, this means that the 'action' param for the reply <form>
element is empty - ie, the POST request goes to the current (topic) permalink. So, everything works properly under normal circumstances.
On my client site, for some reason I haven't determined yet (maybe because we're not using theme compat?), get_permalink()
is not returning an empty string, but is instead returning the URL of the group itself. This causes weird things to happen. bbp_new_reply_handler()
still catches, but cap checks fail, because the bbPress group forum extension only maps group admin/moderator caps to 'participate' when bp_is_group_forum()
.
So, this is kind of a complicated issue, and I don't 100% understand why it's just now cropping up for me. But it seems to me that the current 'action' setup works sorta by accident in the case of BP groups (because they have page ID=0). So, there's no harm in being more precise and filling the action param like this: action="<?php bbp_topic_permalink( bbp_get_topic_id() ); ?>"
Thanks for following along :-D
Change History (5)
#1
@
8 years ago
- Keywords commit added
- Milestone changed from Awaiting Review to 2.6
- Owner set to johnjamesjacoby
#3
@
7 years ago
Sorry to post to a very old thread, but I ran into this problem on another site and it led me back to look at [6452]. It seems to me that the logic there is not quite right. For example, form-reply.php appears on the *topic* page, so the form action should be something like: bbp_topic_permalink( bbp_get_topic_id() )
. The same may be true of other ones, though I haven't checked. @johnjamesjacoby Could you have a look and see if I'm correct about this?
I think we can safely use our template functions here.
Most of these actions actually don't really make a difference, because bbPress listens to all post requests for all of these actions, regardless of the URL they're posted to.
The places where things are conditionally hooked in are the only caveats, and using our functions should alleviate any issues.