Repository navigation
Comments: Make admin comment dimming comment-type aware (Trac #35214, Stage 3) - #57
Open
adamsilverstein wants to merge 10 commits into
Open
adamsilverstein wants to merge 10 commits into
adamsilverstein wants to merge 10 commits into
Conversation
`wp_ajax_dim_comment()` fell back to the global `moderate_comments` primitive when a user could not `edit_comment` the target comment, so a moderator of a custom comment type could not approve or unapprove comments of that type from the admin list table. Route the fallback through the per-comment `moderate_comment` meta capability. For comment types using the default capability model this resolves to `moderate_comments` (behavior unchanged); a type with its own capabilities is gated by its own moderation primitive. This is the last per-comment moderation gate in the admin AJAX path. The remaining `moderate_comments` checks in the list table (bulk action availability, the Empty Spam/Trash button) and in XML-RPC `wp.getComments` are collection-level, not per-comment, and intentionally stay global. See #35214.
Drive `wp_ajax_dim_comment()` through the Ajax test harness: a moderator of an independent `review` type can dim its comments, while a global `moderate_comments` moderator without the type's capabilities is denied. The existing administrator and subscriber tests continue to pass, confirming the default model is unchanged. See #35214.
…ent-type-moderation-admin
- Add the missing @SInCE 7.1.0 changelog entry to wp_ajax_dim_comment() and an inline rationale at the rerouted capability check, making the pattern self-documenting at every rerouted site. - Tests: the un-dim direction (dimming an approved comment unapproves it) for a type moderator, the inverse denial (a type moderator cannot dim a default-model comment), and the unregistered-type back-compat pin (a global moderator retains control of never-registered types via AJAX). Drop the cleanup-only unregister call now handled by the test framework.
…ent-type-moderation-admin
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
…ent-type-moderation-admin
The `@since` entry named 7.1.0, but the change ships in 7.2.0, and the inline comment restated what the meta capability mapping already documents. No behavior change. See #35214.
Trunk added the `reaction` type next to `note`. Neither registers its own capabilities, so `moderate_comment` resolves to `moderate_comments` and a global moderator can still dim them, as before. Pins that, and adds native types to the new helpers and tests so they pass PHPStan level 10. See #35214.
…ent-type-moderation-admin
Trunk is in the 7.2 beta, so these additions can no longer ship in 7.2.0.
This was referenced Nov 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack: Custom Comment Types (#35214)
register_comment_type()registration API/wp/v2/comment-typesendpointmap_meta_cap()render_callbackdisplay callbackis_pingping groupingdefault_excluded_comment_typesfilterwp_update_comment_counts()recount helperWordPress#12311 and WordPress#12310 are on WordPress/wordpress-develop; the rest are fork PRs targeting their parent branch and will retarget to trunk as their base lands.
Claude re-checked the audit here, summary below:
Trac ticket: https://core.trac.wordpress.org/ticket/35214
AI Use
Claude Code wrote the change, tests, and this description. I will review and test.
Summary by CodeRabbit