PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.0.2
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.0.2
11.1.1 11.1.0 11.0.5 11.0.4 11.0.3 11.0.2 11.0.1 11.0.0 10.11.1 10.11.0 10.10.2 10.10.1 10.10.0 10.9.1 trunk 10.0.0 10.0.1 10.1.0 10.1.1 10.1.2 10.1.3 10.1.4 10.2.0 10.2.1 10.2.2 All 62 releases
acymailing / WpInit / Data.php

Data.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 11.0.2, at WpInit/Data.php

45 lines 1015 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\WpInit;
4
5 use AcyMailing\Classes\UserClass;
6 use AcyMailing\Helpers\UserHelper;
7
8 class Data
9 {
10 public function __construct()
11 {
12 add_filter('wp_privacy_personal_data_exporters', [$this, 'registerDataExporters']);
13 }
14
15 public function registerDataExporters(array $exporters): array
16 {
17 $exporters['acymailing'] = [
18 'exporter_friendly_name' => 'AcyMailing',
19 'callback' => [$this, 'exportUserDataByEmail'],
20 ];
21
22 return $exporters;
23 }
24
25 public function exportUserDataByEmail(string $emailAddress, int $page = 1): array
26 {
27 $userClass = new UserClass();
28 $user = $userClass->getOneByEmail($emailAddress);
29
30 if (empty($user)) {
31 return [
32 'data' => [],
33 'done' => true,
34 ];
35 }
36
37 $userHelper = new UserHelper();
38
39 return [
40 'data' => $userHelper->getUserData($user),
41 'done' => true,
42 ];
43 }
44 }
45