Skip to content

Add wp user privacy-request commands for GDPR personal data management#611

Open
Copilot wants to merge 13 commits intomainfrom
copilot/add-data-export-erasure-commands
Open

Add wp user privacy-request commands for GDPR personal data management#611
Copilot wants to merge 13 commits intomainfrom
copilot/add-data-export-erasure-commands

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 22, 2026

WordPress 4.9.6 introduced personal data export and erasure tools (GDPR), but no WP-CLI interface existed for them. This adds a wp user privacy-request command group covering the full lifecycle of user_request posts.

New commands

  • list — Query all requests; filterable by --action-type and --status, supports all standard output formats (table, csv, json, ids, count, yaml)
  • create <email> <action-type> — Create a export_personal_data or remove_personal_data request; --status=pending|confirmed, --send-email, --porcelain
  • delete <request-id>... — Delete one or more requests; batch-reports success/failure counts
  • erase <request-id> — Invoke all registered wp_privacy_personal_data_erasers for the request's email, then mark it request-completed
  • export <request-id> — Invoke all registered wp_privacy_personal_data_exporters, generate the ZIP via wp_privacy_generate_personal_data_export_file(), mark complete, and output the file path
  • complete <request-id>... — Mark one or more requests as request-completed; batch-reports success/failure counts
$ wp user privacy-request create bob@example.com export_personal_data --status=confirmed --porcelain
3
$ wp user privacy-request export 3
Success: Exported personal data to: …/wp-personal-data-exports/wp-personal-data-export-bob-example-com-3.zip

$ wp user privacy-request create bob@example.com remove_personal_data --status=confirmed --porcelain
4
$ wp user privacy-request erase 4
Success: Erased personal data for request 4.

$ wp user privacy-request list --format=csv --fields=ID,user_email,action_name,status
ID,user_email,action_name,status
3,bob@example.com,export_personal_data,request-completed
4,bob@example.com,remove_personal_data,request-completed

Implementation notes

  • erase and export iterate over all registered erasers/exporters page-by-page (matching the admin AJAX flow) before marking the request complete
  • export errors explicitly if wp_privacy_generate_personal_data_export_file() produces no file path
  • wp_delete_user_request() exists since WP 4.9.6 but is absent from the php-stubs/wordpress-stubs library; suppressed with a scoped @phpstan-ignore
  • phpcs.xml.dist updated to include User_Privacy_Request_Command in the existing NamingConventions class-prefix exclusion pattern (consistent with all other command classes)
  • Behat feature file covers create/list/delete/complete/erase/export flows and error cases

Copilot AI linked an issue Apr 22, 2026 that may be closed by this pull request
@github-actions github-actions Bot added command:post Related to 'post' command command:post-create Related to 'post create' command command:post-delete Related to 'post delete' command labels Apr 22, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 22, 2026

Codecov Report

❌ Patch coverage is 83.79630% with 35 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/User_Privacy_Request_Command.php 83.57% 34 Missing ⚠️
entity-command.php 88.88% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copilot AI and others added 2 commits April 22, 2026 11:05
Copilot AI changed the title [WIP] Add commands for erasing and exporting personal data Add wp user privacy-request commands for GDPR personal data management Apr 22, 2026
Copilot AI requested a review from swissspidy April 22, 2026 11:08
@swissspidy

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

@swissspidy swissspidy marked this pull request as ready for review April 22, 2026 19:54
@swissspidy swissspidy requested a review from a team as a code owner April 22, 2026 19:54
Copilot AI review requested due to automatic review settings April 22, 2026 19:54

This comment was marked as resolved.

Comment thread src/User_Privacy_Request_Command.php Outdated
Copilot AI requested a review from swissspidy April 22, 2026 20:34
@swissspidy

This comment was marked as resolved.

gemini-code-assist[bot]

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

This comment was marked as resolved.

@swissspidy

This comment was marked as resolved.

…xport_file_name)

Agent-Logs-Url: https://github.com/wp-cli/entity-command/sessions/76bb4546-13cf-4c5e-90d1-e8679fd9b477

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>

This comment was marked as resolved.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/User_Privacy_Request_Command.php
Comment thread src/User_Privacy_Request_Command.php
@swissspidy swissspidy added this to the 2.8.11 milestone May 3, 2026
Comment thread features/user-privacy-request.feature
Comment thread src/User_Privacy_Request_Command.php Outdated
Copilot AI and others added 2 commits May 4, 2026 09:14
Copilot AI requested a review from swissspidy May 4, 2026 09:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

command:post Related to 'post' command command:post-create Related to 'post create' command command:post-delete Related to 'post delete' command

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Commands for erasing and exporting personal data

3 participants