Skip to content

Add core/users ability#774

Open
jorgefilipecosta wants to merge 16 commits into
developfrom
codex/core-users-ability
Open

Add core/users ability#774
jorgefilipecosta wants to merge 16 commits into
developfrom
codex/core-users-ability

Conversation

@jorgefilipecosta

@jorgefilipecosta jorgefilipecosta commented Jun 25, 2026

Copy link
Copy Markdown
Member

What?

  • Adds a read-only core/users ability with single-user lookup by id, user_email, user_login, or user_nicename.
  • Adds collection mode with optional roles, has_published_posts, page, per_page, and fields; omitted REST input defaults to empty collection mode.
  • Uses WP_User-shaped field names, including user_login, user_email, user_nicename, user_url, and user_registered, to align with Core’s existing core/get-user-info ability.
  • Gates sensitive identifiers and fields against Core REST users behavior, omits inaccessible fields per user, excludes capabilities/meta, and respects get_option( 'show_avatars' ).
  • Adds PHPUnit and browser-level Abilities API coverage.

Testing

  • php -l includes/Abilities/Users/Users.php
  • php -l includes/Main.php
  • php -l tests/Integration/Includes/Abilities/Users/UsersTest.php
  • vendor/bin/phpcs --standard=phpcs.xml.dist includes/Abilities/Users/Users.php includes/Main.php tests/Integration/Includes/Abilities/Users/UsersTest.php
  • vendor/bin/phpstan analyse --memory-limit=1G includes/Abilities/Users/Users.php tests/Integration/Includes/Abilities/Users/UsersTest.php
  • npx wp-scripts lint-js tests/e2e/specs/abilities/core-users.spec.js
  • npm run test:php -- --filter UsersTest
  • npm run test:e2e -- tests/e2e/specs/abilities/core-users.spec.js --project=chromium
  • git diff --check
Open WordPress Playground Preview

@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: jorgefilipecosta <jorgefilipecosta@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions

Copy link
Copy Markdown

✅ WordPress Plugin Check Report

✅ Status: Passed

📊 Report

All checks passed! No errors or warnings found.


🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

@codecov

codecov Bot commented Jun 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.78458% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 77.68%. Comparing base (dd7d364) to head (078efd2).

Files with missing lines Patch % Lines
includes/Abilities/Users/Users.php 94.77% 23 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop     #774      +/-   ##
=============================================
+ Coverage      76.71%   77.68%   +0.97%     
- Complexity      1828     1941     +113     
=============================================
  Files             87       88       +1     
  Lines           7764     8205     +441     
=============================================
+ Hits            5956     6374     +418     
- Misses          1808     1831      +23     
Flag Coverage Δ
unit 77.68% <94.78%> (+0.97%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant