10442 Posts in 2221 Topics by 1718 members
| Go to End | ||
| Author | Topic: | 1521 Views |
-
Re: Newsletter Module

13 February 2012 at 10:21pm Last edited: 13 February 2012 10:33pm
Try taking a look in your database at the groups table it will show you what id your newsletter group is.
Your "Page not found" error is, Im guessing, because i was redirecting everyone who was not a member to my signup page, which you don't have, see this line:
return Director::redirect($this->Link("/sign-up/?s=1&e=" . $email));
You should be able to just add them to your newsletter group if you don't want them to have to become a member first.try this or something like it instead:
function doSubscribeForm($data, $form){
$email = Convert::raw2sql($data['Email']); // prevent sql injection//check if newsletter exists first
if($newsletter_group = DataObject::get_one('Group', "ID = 4")):
if($existing_member = DataObject::get_one("Member", "Email = '$email'")):
$member = $this->CurrentMember();
//If current member matches the existing member.
if($member->ID == $existing_member->ID):
$existing_member->Groups()->add($newsletter_group);
else:
return Director::redirect(Director::BaseURL() . 'Security/login');
endif;
return Director::redirectBack();
else:
//create new member and add them to newsletter group
$member = new Member();
$form->saveInto($member);
$member->write();
$member->Groups()->add($newsletter_group);
endif;
endif;
return Director::redirectBack();
} -
Re: Newsletter Module

14 February 2012 at 7:18am Last edited: 14 February 2012 7:38am
Ok
now the form adds the address to the newsletter module. But, after adding an mail there's no success message.
And after adding the functions my jquery image slider crashes. the console says/termine/?flush=1:31 Uncaught TypeError: Cannot call method 'css' of null
jquery.load.slider.js:2 Uncaught TypeError: Cannot call method 'nivoSlider' of nullwhat's that?!
Regards Benni
EDIT:// Found something which should fix it. This jQuery.noConflict thing.
But after Adding this. The Subscriberform doesn't work. It just redirects to /security and doesn't give the mail to the module
| 1521 Views | ||
| Go to Top |


