Browse code

Add compatibility for ModuleRegistration and ModulePersonalData

Benjamin Roth authored on22/03/2023 13:06:30
Showing1 changed files
... ...
@@ -21,11 +21,16 @@ use Contao\DataContainer;
21 21
  */
22 22
 class MemberNcNewsNotificationChangedateListener
23 23
 {
24
-    public function __invoke($varValue, DataContainer $dc)
24
+    public function __invoke($varValue, $context)
25 25
     {
26
-        if ($varValue != $dc->activeRecord->nc_news_subscribe)
26
+        if ($context instanceof DataContainer)
27 27
         {
28
-            Database::getInstance()->prepare("UPDATE tl_member SET nc_news_subscribe_changed=? WHERE id=?")->execute(array(time(),$dc->id));
28
+            $context = $context->activeRecord;
29
+        }
30
+
31
+        if ($varValue != $context->nc_news_subscribe)
32
+        {
33
+            Database::getInstance()->prepare("UPDATE tl_member SET nc_news_subscribe_changed=? WHERE id=?")->execute(array(time(),$context->id));
29 34
         }
30 35
 
31 36
         return $varValue;