Opened 4 weeks ago
#3753 new enhancement
Make read meta capabilities authoritative for forum content
| Reported by: | johnjamesjacoby | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | API - Roles/Capabilities | Version: | trunk |
| Severity: | normal | Keywords: | needs-design |
| Cc: |
Description
bbPress has object-level read_forum, read_topic, and read_reply meta capabilities, but they do not currently answer the complete question implied by their names. read_forum includes forum visibility and ancestor handling, while read_topic primarily evaluates topic status and read_reply primarily evaluates reply status.
Callers that need to decide whether content may be exposed must therefore reconstruct the complete answer from object status, parent capabilities, forum visibility, and forum ancestry. Variations of this logic now exist in shortcodes, widgets, REST responses, feeds, subscriptions, BuddyPress screens, engagements, direct reply handling, and old-slug redirects. Each copy can omit a different parent relationship.
Recent examples include [7350], [7503], [7504], [7681], and #3752.
Desired contract
read_forumdetermines whether the user can read the forum, including restricted ancestors and integration-specific access.read_topicrequires a readable parent forum, then applies topic-status access.read_replyrequires a readable parent topic, then applies reply-status access.- Callers ask one capability question about the object they intend to expose instead of rebuilding the parent chain.
- Existing helpers such as
bbp_user_can_view_forum()become compatibility wrappers around the authoritative capability decision. - BuddyPress group access participates at the forum capability layer so topic and reply surfaces do not each need group-specific visibility logic.
Post passwords, nonce validation, and the request-specific choice between a 404 or another response remain separate concerns.
Compatibility and design considerations
The capability dependency must remain acyclic: forum to topic to reply. #2140 previously exposed recursive meta-capability mapping, so this should not be implemented by adding unstructured nested user_can() calls throughout the filters. The design should compose the required primitive capabilities or otherwise prevent recursive mapping while preserving existing extension filters.
The access matrix needs anonymous visitors, authors, participants, forum moderators, and global moderators across public, private, hidden, nested, pending, spam, and trashed objects. It also needs BuddyPress group members, outsiders, banned members, nested group forums, and extensions that filter the existing meta-capability hooks.
Once the capability contract is covered, migrate callers incrementally and remove redundant inline visibility chains.