From: Stéphane Jacob Date: Thu, 21 Jul 2011 08:01:47 +0000 (+0200) Subject: Fixes NL unsubscription when not loggued on the site (Closes #1524). X-Git-Tag: xorg/1.1.3~41 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=440b8516ef53b9df9fd7c0c827b755cd54e7ab73;hp=4eb1f02cfc1deb1ea0cca4841c1d4645eb28b653;p=platal.git Fixes NL unsubscription when not loggued on the site (Closes #1524). Signed-off-by: Stéphane Jacob --- diff --git a/ChangeLog b/ChangeLog index bbfdf16..8d7e925 100644 --- a/ChangeLog +++ b/ChangeLog @@ -8,6 +8,9 @@ Bug/Wish: From 1.1.2 branch: + * Newsletter: + - #1524: Fixes NL unsubscription when not loggued on the site -JAC + * Search: - #1520: Fixes deltaten -XEL diff --git a/modules/newsletter.php b/modules/newsletter.php index a975ba3..6603bc8 100644 --- a/modules/newsletter.php +++ b/modules/newsletter.php @@ -55,16 +55,26 @@ class NewsletterModule extends PLModule return PL_NOT_FOUND; } - $page->changeTpl('newsletter/index.tpl'); - $page->setTitle('Lettres mensuelles'); - $hash = ($hash == 'nohash') ? null : $hash; switch ($action) { - case 'out': $nl->unsubscribe($issue_id, $hash, $hash != null); break; + case 'out': + $success = $nl->unsubscribe($issue_id, $hash, $hash != null); + if (!is_null($hash)) { + if ($success) { + $page->trigSuccess('La désinscription a été effectuée avec succès.'); + } else { + $page->trigError("La désinscription n'a été pas pu être effectuée."); + } + return; + } + break; case 'in': $nl->subscribe(); break; default: ; } + $page->changeTpl('newsletter/index.tpl'); + $page->setTitle('Lettres mensuelles'); + $page->assign_by_ref('nl', $nl); $page->assign('nls', $nl->subscriptionState()); $page->assign('nl_list', $nl->listSentIssues(true));