Moving to GitHub.
[platal.git] / modules / xnetgrp.php
index cc39f46..53ebb12 100644 (file)
@@ -920,7 +920,11 @@ class XnetGrpModule extends PLModule
                 break;
             }
         }
-        http_redirect($_SERVER['HTTP_REFERER']);
+        if (!empty($_SERVER['HTTP_REFERER'])) {
+            http_redirect($_SERVER['HTTP_REFERER']);
+        } else {
+            pl_redirect('');
+        }
     }
 
     function handler_admin_annuaire($page)
@@ -1222,6 +1226,11 @@ class XnetGrpModule extends PLModule
             $mailer->send();
         }
 
+        $nl = Newsletter::forGroup($globals->asso('shortname'));
+        if (!is_null($nl)) {
+            $nl->unsubscribe(null, S::i('uid'));
+        }
+
         $domain = $globals->asso('mail_domain');
         if (!$domain) {
             return true;