PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 10.11.1
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v10.11.1
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 / back / Controllers / UsersController.php

UsersController.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress 10.11.1, at back/Controllers/UsersController.php

89 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace AcyMailing\Controllers;
4
5 use AcyMailing\Classes\UserClass;
6 use AcyMailing\Core\AcymController;
7 use AcyMailing\Controllers\Users\Listing;
8 use AcyMailing\Controllers\Users\Edition;
9 use AcyMailing\Controllers\Users\Import;
10 use AcyMailing\Controllers\Users\Export;
11 use AcyMailing\Controllers\Users\Subscription;
12
13 class UsersController extends AcymController
14 {
15 use Listing;
16 use Edition;
17 use Import;
18 use Export;
19 use Subscription;
20
21 public function __construct()
22 {
23 parent::__construct();
24
25 $this->breadcrumb[acym_translation('ACYM_SUBSCRIBERS')] = acym_completeLink('users');
26 $this->loadScripts = [
27 'edit' => ['datepicker'],
28 'all' => ['vue-applications' => ['entity_select']],
29 ];
30 }
31
32 public function getAll(): array
33 {
34 $userClass = new UserClass();
35
36 return $userClass->getAll();
37 }
38
39 public function clean(): void
40 {
41 if (acym_isAcyCheckerInstalled()) {
42 if (ACYM_CMS === 'joomla') {
43 acym_redirect(acym_route('index.php?option=com_acychecker', false));
44 } else {
45 acym_redirect(admin_url().'admin.php?page=acychecker_dashboard');
46 }
47 } else {
48 acym_redirect(acym_completeLink('dashboard&task=acychecker', false, true));
49 }
50 }
51
52 public function getUserInfoAjax(): void
53 {
54 $userId = acym_getVar('int', 'userId', 0);
55
56 if (empty($userId)) {
57 acym_sendAjaxResponse(acym_translation('ACYM_USER_NOT_FOUND'), [], false);
58 }
59
60 $userClass = new UserClass();
61 $user = $userClass->getCustomFieldValueById($userId);
62
63 if (empty($user)) {
64 acym_sendAjaxResponse(acym_translation('ACYM_SUBSCRIBER_NOT_CUSTOM_FIELD'), [], false);
65 }
66
67 acym_sendAjaxResponse('', $user);
68 }
69
70 public function searchTestReceiversAjax(): void
71 {
72 if (!acym_isAllowed('users')) {
73 echo json_encode([]);
74 exit;
75 }
76
77 $search = acym_getVar('string', 'search', '');
78 $userClass = new UserClass();
79 $users = $userClass->getUsersLikeEmail($search);
80
81 $return = [];
82 foreach ($users as $oneUser) {
83 $return[] = [$oneUser->id, $oneUser->email];
84 }
85 echo json_encode($return);
86 exit;
87 }
88 }
89