simplenews_mailjet_subscriptions: added rules action to respond to unsubscribe webhook

This commit is contained in:
2022-06-17 12:10:32 +02:00
parent a528b89949
commit 6f26734eac
2 changed files with 18 additions and 20 deletions

View File

@@ -303,10 +303,10 @@ index 98342b5..f67ba96 100644
'#type' => 'submit',
diff --git a/src/Plugin/RulesAction/UnsubscribeFromList.php b/src/Plugin/RulesAction/UnsubscribeFromList.php
new file mode 100644
index 0000000..b880ed2
index 0000000..3f546ef
--- /dev/null
+++ b/src/Plugin/RulesAction/UnsubscribeFromList.php
@@ -0,0 +1,49 @@
@@ -0,0 +1,51 @@
+<?php
+
+namespace Drupal\simplenews_mailjet_subscriptions\Plugin\RulesAction;
@@ -347,7 +347,9 @@ index 0000000..b880ed2
+ protected function doExecute(integer $listID, string $email) {
+ $l = $listID;
+ $e = $email;
+ \Drupal::logger('simplenews_mailjet_subscriptions')->notice("Unsubscribe webhook triggered for listID: " . $listID . ", and email: " . $email . ".");
+ \Drupal::logger('simplenews_mailjet_subscriptions')->notice(print_r($listID, true));
+ // \Drupal::logger('simplenews_mailjet_subscriptions')->notice("Unsubscribe webhook triggered for listID: " . $listID . ", and email: " . $email . ".");
+
+ // find corresponding simplenews list from mailjet listID
+
+ // get subscriber entity