PluginProbe
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress / trunk
AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress vtrunk
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 10.3.0 10.4.0 All 60 releases
acymailing / back / dynamics / subscription / SubscriptionFollowup.php

SubscriptionFollowup.php in AcyMailing – An Ultimate Newsletter Plugin and Marketing Automation Solution for WordPress trunk, at back/dynamics/subscription/SubscriptionFollowup.php

50 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 trait SubscriptionFollowup
4 {
5 public function matchFollowupsConditions(&$followups, $userId, $params)
6 {
7 foreach ($followups as $key => $followup) {
8 if (empty($followup->condition['lists_status']) || empty($followup->condition['lists'])) {
9 continue;
10 }
11
12 $status = $followup->condition['lists_status'] === 'is';
13 if ($followup->trigger === $this->subscribeTrigger) {
14 $user = false;
15 foreach ($followup->condition['lists'] as $list) {
16 if (in_array($list, $params['sub_lists'])) {
17 $user = true;
18 break;
19 }
20 }
21 } else {
22 acym_arrayToInteger($followup->condition['lists']);
23 $lists = implode(',', $followup->condition['lists']);
24 $user = acym_loadObject('SELECT * FROM #__acym_user_has_list WHERE user_id = '.intval($userId).' AND status = 1 AND list_id IN ('.$lists.')');
25 }
26
27 if (($status && empty($user)) || (!$status && !empty($user))) {
28 unset($followups[$key]);
29 }
30 }
31 }
32
33 public function getFollowupTriggers(&$triggers)
34 {
35 $triggers[$this->subscribeTrigger] = acym_translation('ACYM_USER_SUBSCRIBES');
36 }
37
38 public function getFollowupTriggerBlock(&$blocks)
39 {
40 $blocks[] = [
41 'name' => acym_translation('ACYM_USER_SUBSCRIBES'),
42 'description' => acym_translation('ACYM_USER_SUBSCRIBES_DESC'),
43 'icon' => 'acymicon-user-check',
44 'link' => acym_completeLink('campaigns&task=edit&step=followupCondition&trigger='.$this->subscribeTrigger),
45 'level' => 2,
46 'alias' => $this->subscribeTrigger,
47 ];
48 }
49 }
50