name = __( 'Square', 'woocommerce-square' );
$this->add_eraser( 'woocommerce-square-customer-data', __( 'WooCommerce Square Customer Data', 'woocommerce-square' ), array( $this, 'customer_data_eraser' ) );
}
/**
* Gets the message to display.
*
* @since 2.0.0
*/
public function get_privacy_message() {
return wpautop(
sprintf(
/* translators: Placeholder: %1$s - tag, %2$s - tag */
__( 'By using this extension, you may be storing personal data or sharing data with an external service. %1$sLearn more about how this works, including what you may want to include in your privacy policy.%2$s', 'woocommerce-square' ),
'',
''
)
);
}
/**
* Finds and erases customer data by email address.
*
* @since 2.0.0
*
* @param string $email_address the user email address
* @param int $page page
* @return array an array of personal data in name => value pairs
*/
public function customer_data_eraser( $email_address, $page ) {
// check if user has an ID to load stored personal data
$user = get_user_by( 'email', $email_address );
$square_customer_id = get_user_meta( $user->ID, 'wc_square_customer_id', true );
$items_removed = false;
$messages = array();
if ( ! empty( $square_customer_id ) ) {
$items_removed = true;
delete_user_meta( $user->ID, 'wc_square_customer_id' );
$messages[] = __( 'Square User Data Erased.', 'woocommerce-square' );
}
return array(
'items_removed' => $items_removed,
'items_retained' => false,
'messages' => $messages,
'done' => true,
);
}
}