From e395163dd97a21bc6a5db9ab512d1021d133dc57 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Tue, 26 Feb 2013 05:09:58 +0100 Subject: [PATCH] Fix existing subscription check, to only count e-mail addresses that have subscribed to that particular campaign --- public_html/modules/subscribe.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/public_html/modules/subscribe.php b/public_html/modules/subscribe.php index 7fe2de0..f15dc91 100644 --- a/public_html/modules/subscribe.php +++ b/public_html/modules/subscribe.php @@ -46,8 +46,16 @@ if(empty($_POST['amount']) || preg_match("([0-9]*[.,][0-9]+|[0-9]+)", $_POST['am try { - Subscription::FindByEmail($_POST['email']); - $exists = true; + $exists = false; + + foreach(Subscription::FindByEmail($_POST['email']) as $sSubscription) + { + if($sSubscription->sCampaignId == $sCampaign->sId) + { + $exists = true; + } + } + } catch (NotFoundException $e) {