Skip to content

Expose add_to_blog, new_role, and blog_id fields in signup list and get - #630

Open
swissspidy wants to merge 1 commit into
mainfrom
add/signup-fields
Open

Expose add_to_blog, new_role, and blog_id fields in signup list and get#630
swissspidy wants to merge 1 commit into
mainfrom
add/signup-fields

Conversation

@swissspidy

@swissspidy swissspidy commented Jul 29, 2026

Copy link
Copy Markdown
Member

Exposes add_to_blog, new_role, and blog_id as available fields for wp user signup list and wp user signup get, and enables filtering by them.

  • Unserializes signup meta properties so add_to_blog and new_role are accessible as fields.
  • Aliases add_to_blog and blog_id to allow querying and filtering by either name.
  • Updates filtering logic in Signup_Command::list_() to support filtering by --new_role, --blog_id, and --add_to_blog.
  • Added acceptance test scenarios covering field output and filtering.

Closes #629

Summary by CodeRabbit

  • New Features

    • Added signup list and detail fields for add_to_blog, new_role, and blog_id.
    • Added filtering signups by blog ID, target blog, and role.
    • Improved signup details and list output consistency.
  • Tests

    • Added coverage for displaying, filtering, and retrieving the new signup fields.
    • Updated signup scenarios for more reliable command execution.

@swissspidy
swissspidy requested a review from a team as a code owner July 29, 2026 10:15
@swissspidy swissspidy added this to the 2.8.13 milestone Jul 29, 2026
@github-actions github-actions Bot added command:network-meta Related to 'network meta' command command:network-meta-get Related to 'network meta get' command command:network-meta-list Related to 'network meta list' command command:network-meta-update Related to 'network meta update' command labels Jul 29, 2026
@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

Signup_Command now exposes normalized add_to_blog, new_role, and blog_id fields, supports filtering by them, and formats retrieved signups consistently. Signup feature coverage validates the new behavior and updates wp eval quoting across existing scenarios.

Changes

Signup metadata exposure

Layer / File(s) Summary
Normalize signup metadata and output fields
src/Signup_Command.php
Serialized signup metadata is promoted to top-level fields, blog identifiers are synchronized, and get uses an object for field selection and formatting.
Filter and validate signup fields
src/Signup_Command.php, features/signup.feature
Listing filters prepared signup records by fields including new_role, blog_id, and add_to_blog; feature scenarios validate listing, retrieval, filtering, and updated command quoting.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: brianhenryie, ernilambar, janw-me

Sequence Diagram(s)

sequenceDiagram
  participant CLI as WP-CLI
  participant Command as Signup_Command
  participant Records as Multisite signups
  CLI->>Command: list with signup filters
  Command->>Records: fetch signup records
  Records-->>Command: signup data and serialized metadata
  Command-->>CLI: filtered formatted fields
  CLI->>Command: get signup
  Command->>Records: fetch selected signup
  Records-->>Command: normalized signup fields
  Command-->>CLI: add_to_blog, new_role, and blog_id
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main change: exposing add_to_blog, new_role, and blog_id in signup list/get output.
Linked Issues check ✅ Passed The PR satisfies #629 by exposing blog_id and new_role as queryable/output fields and adding coverage for those filters.
Out of Scope Changes check ✅ Passed The changes stay focused on signup field exposure, aliases, filtering, and related acceptance tests.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch add/signup-fields

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Jul 29, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/Signup_Command.php 95.23% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy added command:user-signup Related to 'user signup' command command:user-signup-get Related to 'user signup get' command command:user-signup-list Related to 'user signup list' command and removed command:network-meta Related to 'network meta' command command:network-meta-get Related to 'network meta get' command command:network-meta-list Related to 'network meta list' command command:network-meta-update Related to 'network meta update' command labels Jul 29, 2026
@swissspidy

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/Signup_Command.php (1)

149-166: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Apply --per_page after metadata filtering.

The SQL LIMIT runs before this loop, so --blog_id=228 --per_page=1 can return no result even when a matching signup exists later in the table. Filter prepared items first, then slice the filtered list (or push applicable filters into SQL). Add a Behat regression case combining a metadata filter with --per_page.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/Signup_Command.php` around lines 149 - 166, Update the signup filtering
flow around prepare_signup_array so metadata filters are applied to all eligible
results before enforcing per_page pagination; avoid relying on the SQL LIMIT for
this filtered path. Preserve existing filter matching behavior, then slice the
filtered signups to the requested per_page count, and add a Behat regression
case combining a metadata filter such as --blog_id with --per_page.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@src/Signup_Command.php`:
- Around line 149-166: Update the signup filtering flow around
prepare_signup_array so metadata filters are applied to all eligible results
before enforcing per_page pagination; avoid relying on the SQL LIMIT for this
filtered path. Preserve existing filter matching behavior, then slice the
filtered signups to the requested per_page count, and add a Behat regression
case combining a metadata filter such as --blog_id with --per_page.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 580fe291-bb09-4452-a4ec-906535fe388e

📥 Commits

Reviewing files that changed from the base of the PR and between f5a29a2 and 0aa207b.

📒 Files selected for processing (2)
  • features/signup.feature
  • src/Signup_Command.php

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

Labels

command:user-signup Related to 'user signup' command command:user-signup-get Related to 'user signup get' command command:user-signup-list Related to 'user signup list' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please expose add_to_blog and new_role as fields in signup

1 participant