PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / 11.1.0
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress v11.1.0
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
← All changes | back/Controllers/Users/Listing.php +25 -13 10.11.1 → 11.1.0 View file →
@@ -17,10 +17,10 @@
17 17 {
18 18 acym_setVar('layout', 'listing');
19 19
20 20 $data = [];
21 - $data['ordering'] = $this->getVarFiltersListing('string', 'users_ordering', 'id');
22 - $data['orderingSortOrder'] = $this->getVarFiltersListing('string', 'users_ordering_sort_order', 'desc');
21 + $data['ordering'] = $this->getVarFiltersListing('cmd', 'users_ordering', 'id');
22 + $data['orderingSortOrder'] = $this->getVarFiltersListing('cmd', 'users_ordering_sort_order', 'desc');
23 23 $data['pagination'] = new PaginationHelper();
24 24
25 25 $this->prepareSegmentField($data);
26 26 $this->prepareListingFilters($data);
@@ -84,22 +84,29 @@
84 84 'download'
85 85 );
86 86 $toolbarHelper->addButton(acym_translation('ACYM_IMPORT'), ['data-task' => 'import'], 'upload');
87 87 $entityHelper = new EntitySelectHelper();
88 - $otherContent = acym_modal(
89 - '<i class="acymicon-bell"></i>'.acym_translation('ACYM_SUBSCRIBE').' (<span id="acym__users__listing__number_to_add_to_list">0</span>)',
90 - $entityHelper->entitySelect('list', ['join' => ''], $entityHelper->getColumnsForList(), [
91 - 'text' => acym_translation('ACYM_SUBSCRIBE_USERS_TO_THESE_LISTS'),
92 - 'action' => 'addToList',
93 - ]),
94 - null,
95 - [],
88 + $toolbarHelper->addModalButton(
96 89 [
97 - 'class' => 'button button-secondary disabled cell medium-6 large-shrink',
98 - 'id' => 'acym__users__listing__button--add-to-list',
90 + 'button' => '<i class="acymicon-bell"></i>'.esc_html(
91 + acym_translation('ACYM_SUBSCRIBE')
92 + ).' (<span id="acym__users__listing__number_to_add_to_list">0</span>)',
93 + 'modalContent' => $entityHelper->entitySelect(
94 + [
95 + 'entity' => 'list',
96 + 'columnsToDisplay' => $entityHelper->getColumnsForList(),
97 + 'buttonSubmit' => [
98 + 'text' => acym_translation('ACYM_SUBSCRIBE_USERS_TO_THESE_LISTS'),
99 + 'action' => 'addToList',
100 + ],
101 + ]
102 + ),
103 + 'attributesButton' => [
104 + 'class' => 'button button-secondary disabled cell medium-6 large-shrink',
105 + 'id' => 'acym__users__listing__button--add-to-list',
106 + ],
99 107 ]
100 108 );
101 - $toolbarHelper->addOtherContent($otherContent);
102 109 $toolbarHelper->addButton(acym_translation('ACYM_CREATE'), ['data-task' => 'edit'], 'user-plus', true);
103 110
104 111 $data['toolbar'] = $toolbarHelper;
105 112 }
@@ -121,8 +128,9 @@
121 128 return strtolower($a->name) > strtolower($b->name) ? 1 : -1;
122 129 }
123 130 );
124 131
132 + // This keeps keys
125 133 $data['lists'] = [0 => acym_translation('ACYM_SELECT_A_LIST')];
126 134 foreach ($lists as $oneList) {
127 135 if ($oneList->type === ListClass::LIST_TYPE_FRONT) continue;
128 136 if ($oneList->type === ListClass::LIST_TYPE_FOLLOWUP) {
@@ -153,8 +161,9 @@
153 161 }
154 162
155 163 protected function prepareUsersListing(array &$data): void
156 164 {
165 + // Prepare the pagination
157 166 $usersPerPage = $data['pagination']->getListLimit();
158 167 $page = $this->getVarFiltersListing('int', 'users_pagination_page', 1);
159 168
160 169 $matchingUsers = $this->getMatchingElementsFromData(
@@ -173,8 +182,9 @@
173 182 $data['status'],
174 183 $page
175 184 );
176 185
186 + // Prepare the pagination
177 187 $data['pagination']->setStatus($matchingUsers['total']->total, $page, $usersPerPage);
178 188
179 189 $data['allUsers'] = $matchingUsers['elements'];
180 190 $data['userNumberPerStatus'] = $matchingUsers['status'];
@@ -234,8 +244,10 @@
234 244 }
235 245
236 246 public function addToList(): void
237 247 {
248 + wp_verify_nonce(acym_getVar('cmd', '_wpnonce'), 'acymnonce') || die('Invalid Token');
249 +
238 250 $listsSelected = json_decode(acym_getVar('string', 'acym__entity_select__selected', '[]'), true);
239 251 if (empty($listsSelected)) {
240 252 $listsSelected = [];
241 253 }