Repository navigation
Capabilities: Define the legacy edit_page alias for activity posts. - #63
Merged
Merged
Conversation
WordPress can check edit_page against an activity post. Map that alias to list_users so the capability lookup does not emit an undefined-property warning while preserving the existing activity-edit permission. Cover the registration and WordPress capability mapping with unit and multisite integration assertions.
The integration smoke file is pinned by central policy. Keep the capability regression in the unit suite and leave the smoke file unchanged in this plugin pull request.
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The capability mapping is correct, compatible, and covered by a focused regression test.
Review effort: Balanced
Findings: None
What changed in this PR
Defines the legacy edit_page capability to prevent undefined-property warnings during activity post checks.
Changes:
- Maps
edit_pagetolist_users. - Adds a focused regression test.
| File | Description |
|---|---|
wp-user-activity/includes/post-types.php |
Registers the legacy capability alias. |
tests/PostTypeTest.php |
Verifies the capability mapping. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Summary
Define the legacy
edit_pagecapability for activity posts and map it to the existinglist_userspermission. This prevents WordPress from reading an undefined capability property when an activity post is checked throughedit_page.Add a focused unit regression for the post type capability registration. The change addresses the warning reported in the WordPress.org support topic.
Validation
Undefined property: stdClass::$edit_pagein a real WordPress test site with the mapping removed for one request; the same check returnedlist_userswithout a warning with the mapping present.composer test, PHPCS baseline, PHPStan, PHP syntax checks, and the existing multisite integration smoke test passed locally.