Skip to:
Content

Opened 10 months ago

Closed 4 months ago

#3030 closed defect (fixed)

'action' for reply form should be more specific

Reported by: boonebgorges Owned by: johnjamesjacoby
Milestone: 2.6 Priority: normal
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 (2)

#1 @johnjamesjacoby
4 months ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to 2.6
  • Owner set to johnjamesjacoby

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.

#2 @johnjamesjacoby
4 months ago

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

In 6452:

Templates: Replace the_permalink() calls with more specific template tags.

Resolves issue where BuddyPress group forums would collide with literal page IDs when not using theme-compat.

Fixes #3030.

Note: See TracTickets for help on using tickets.