Skip to:
Content

bbPress.org

Opened 4 weeks ago

#3746 new enhancement

Forums: Support inherited per-forum setting overrides

Reported by: johnjamesjacoby Owned by:
Priority: normal Milestone: 2.7
Component: API - Settings/Options Version: trunk
Severity: normal Keywords: needs-design-feedback
Cc:

Description

bbPress currently stores most behavioral forum settings as site-wide options. This works for smaller installations, but sites with multiple kinds of forums often need different policies for different parts of the forum hierarchy.

A concrete example is the edit window. A site may allow participants to edit normal support topics and replies for 60 minutes, while allowing reviews or another designated forum to be edited indefinitely. WordPress.org currently needs custom capability handling for this distinction.

Core now consistently enforces the global edit window through capability mapping and front-end submission handlers. See #3164, [6713], and [7679]. A per-forum policy should therefore be resolved before those checks rather than repaired afterward by site-specific capability filters.

Goals

Introduce an API for registered settings that may be overridden by an individual forum and inherited through the forum hierarchy.

The effective value should be resolved in this order:

  1. An explicit value on the requested forum.
  2. The nearest ancestor forum with an explicit value.
  3. The existing site-wide bbPress option.
  4. The registered core default.

A forum with no saved override must behave exactly as it does today.

The first implementation should support the edit window. This provides a small, useful implementation on which the API, storage, caching, administration interface, and tests can be established.

Proposed API

The exact names are open to discussion, but the API should provide equivalents of:

bbp_register_forum_setting( $setting, $args );
bbp_get_forum_setting( $forum_id, $setting, $default = null );
bbp_get_forum_setting_source( $forum_id, $setting );
bbp_delete_forum_setting( $forum_id, $setting );

Registered settings should define:

  • The site-wide option used as their fallback.
  • Value type and sanitization callback.
  • Core default.
  • Whether parent-forum inheritance is supported.
  • Administration label and description.
  • Capability required to change the override.
  • Any restrictions on whether a forum may relax or only strengthen the global policy.

Topic and reply operations should resolve their forum explicitly. The API should not depend on the current screen, queried object, or another ambient global because submissions, feeds, email, REST requests, WP-CLI, and background operations may not have reliable theme context.

Administration

The forum editing screen should contain a Forum Settings or Forum Policies section.

Each setting should provide an Inherit choice. The interface should show the currently inherited value and whether it comes from the parent forum or the site-wide setting.

Examples:

  • Edit window: Inherit, disabled, unlimited, or a number of minutes.
  • Topic tags: Inherit, enabled, or disabled.
  • Anonymous posting: Inherit, enabled, or disabled.
  • Threading: Inherit, enabled, or disabled, with an optional depth.
  • Pagination: Inherit or a positive number.

Deleting an override should restore inheritance rather than copying the current parent or global value into forum metadata.

Backward compatibility

Existing site-wide options remain authoritative defaults.

Existing getter functions and filters must continue to work. Contextual wrappers may be introduced where changing an existing function signature would be ambiguous. In particular, current parameters such as the default passed to bbp_get_edit_lock() must not be reinterpreted as forum IDs.

Existing filters should continue to affect the global fallback. The final effective value should also have a contextual filter receiving the forum ID and the source from which the value was inherited.

No database migration should be required. The absence of forum metadata means that the existing global setting is inherited.

Setting categories

Settings that are initially suitable for normal forum inheritance include:

  • Participant editing and edit-window duration.
  • Anonymous posting.
  • Link moderation threshold.
  • Topic tags.
  • Topic and reply revisions.
  • Threaded replies and thread depth.
  • Editor and auto-embed behavior.
  • Topics and replies per page.
  • Topics and replies per RSS page.

Some settings need both a global feature gate and a separate per-forum policy:

  • Favorites.
  • Subscriptions.
  • Engagements.
  • Search inclusion.

For example, disabling new subscriptions in one forum must not prevent a user from seeing or removing an existing subscription.

Security-sensitive settings may need constrained inheritance rather than simple replacement. A child forum may be allowed to use stricter throttling or moderation than its parent while not being allowed to weaken a required site-wide minimum.

Installation and routing settings should remain global, including:

  • Rewrite slugs and permalink structure.
  • Default user role and global-access behavior.
  • Theme package.
  • Engagement storage strategy.
  • BuddyPress and Akismet integration activation.
  • Converter settings.

Edit-window first implementation

The initial patch should:

  • Register edit-window policy as an inheritable forum setting.
  • Add an Inherit option to the forum editing interface.
  • Allow 0 to retain its existing meaning of unlimited editing.
  • Resolve the forum from the topic or reply being edited.
  • Apply the same effective value in edit-link visibility, capability mapping, and submission handlers.
  • Preserve Moderator, Keymaster, and per-forum moderator behavior.
  • Cover direct edit URLs and forged form submissions.
  • Include tests for global fallback, direct override, parent inheritance, child override, unlimited editing, expired editing, and moderator exceptions.

This also provides a clean solution for sites where one forum, such as a reviews forum, needs an unlimited edit window while other forums retain a finite window.

Roadmap

The work can land incrementally:

  1. Add the setting registry, inheritance resolver, source reporting, caching, invalidation, and administration interface. Convert edit-window enforcement everywhere.
  2. Convert posting and moderation policies: participant editing, anonymous posting, link moderation, revisions, topic tags, and any constrained throttling policy.
  3. Convert conversation and presentation behavior: threaded replies, depth, editor, auto-embed, pagination, and RSS page sizes.
  4. Separate global availability from per-forum permissions for subscriptions, favorites, engagements, and search inclusion. Preserve visibility and removal of existing relationships when creation is disabled.
  5. Audit BuddyPress Group Forum behavior and document explicit context for REST, WP-CLI, feeds, email, and custom integrations.
  6. Classify every remaining behavioral option as inheritable, constrained, globally gated, or installation-only, then complete developer and user documentation.

The registry and edit-window implementation should be the first deliverable. Other settings can move onto the API independently rather than requiring one large patch.

Related tickets

This generalizes several existing pieces without reopening their settled behavior:

  • #3352 introduced a bbPress-specific moderation link setting with a WordPress option fallback.
  • #3386 established that an edit-window value of 0 means unlimited editing.
  • #3164 and [7679] established consistent edit-window enforcement.
  • #3680 established that closed content retains normal edit capabilities and edit locks.
  • #3702 established a site-wide policy layer above individual forum and topic state.
  • #459 provides precedent for contextual per-forum metadata and capability behavior.
  • #707 and #732 contain the historical forum-metadata and per-forum-policy discussions.

Unlike #732, #686, and #2819, this ticket does not introduce arbitrary role-based access-control rules. It provides a bounded registry of core behavioral settings with global defaults and forum-hierarchy inheritance.

Change History (0)

Note: See TracTickets for help on using tickets.