Opened 5 years ago
Last modified 2 months ago
#54442 new defect (bug)
Provide feedback if initiating an email for a personal data request action has failed
| Reported by: | ocean90 | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Privacy | Version: | 4.9.6 |
| Severity: | normal | Keywords: | good-first-bug has-patch has-unit-tests |
| Cc: | Focuses: |
Description
When creating a request for an export or a delete personal data request and the confirmation email is enabled, the user doesn't get any feedback if wp_send_user_request() was successful. The function returns a WP_Error object on failure which should be checked and displayed to the user.
Attachments (1)
Change History (4)
This ticket was mentioned in PR #4083 on WordPress/wordpress-develop by @atiqsu.
4 years ago
#2
- Checking if request action is WP_Error, if so sending settings error to be displayed to the use
- Updated gitignore for phpStorm IDE
The code is actually from @hasanuzzamanshamim with little update.
Trac ticket: https://core.trac.wordpress.org/ticket/54442
This ticket was mentioned in PR #12923 on WordPress/wordpress-develop by @irozum.
2 months ago
#3
- Keywords has-unit-tests added
What: When an admin adds a new personal data export/erasure request with "send confirmation email" checked, _wp_personal_data_handle_actions() calls wp_send_user_request() but discards its return value, then unconditionally shows "Confirmation request initiated successfully." Since wp_send_user_request() returns a WP_Error on mail failure, the admin gets a false success message even when the confirmation email never went out — leaving the request stuck pending with no obvious explanation.
Fix: Check the return value of wp_send_user_request() and, if it's a WP_Error, surface the actual error message via add_settings_error() (type error) instead of the canned success string — mirroring the existing pattern used a few lines above for wp_create_user_request() failures and in _wp_privacy_resend_request()'s retry path.
Tests: Added tests/phpunit/tests/privacy/wpPersonalDataHandleActions.php, covering both the failure path (forcing wp_mail() to fail via the wp_mail_from filter, per the existing pattern in Tests_User_wpSendUserRequest) and the existing success path as a regression guard.
## Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5
Used for: Implementation, tests, and PR description. Reviewed by Igor Rozum.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Error check patch created