Filter
rpress_should_anonymize_customer
On this page
Filters whether a customer may be anonymized by a privacy erasure request.
Runs in _rpress_anonymize_customer() after the customer record has been found. The value is an array with 'should_anonymize' (true by default) and 'message'. If 'should_anonymize' is empty, the customer is left untouched and the message is returned as the reason.
Available since RestroPress 2.9.2.
Parameters#
| Parameter | Type | Description |
|---|---|---|
$result | array | Array with 'should_anonymize' (bool) and 'message' (string). |
$customer | RPRESS_Customer | The customer being anonymized. |
Return value#
array. Array with 'should_anonymize' and 'message'.
Example#
add_filter( 'rpress_should_anonymize_customer', 'my_block_anonymize_with_open_orders', 10, 2 );
function my_block_anonymize_with_open_orders( $result, $customer ) {
$open = rpress_get_payments( array( 'customer' => $customer->id, 'status' => 'pending', 'number' => 1 ) );
if ( ! empty( $open ) ) {
$result['should_anonymize'] = false;
$result['message'] = __( 'This customer has an open order.', 'my-plugin' );
}
return $result;
}
Source#
Applied in:
includes/privacy-functions.php(line 223), in_rpress_anonymize_customer()
See also#
Was this page helpful?
