Jump to:

10979 Posts in 2722 Topics by 1815 members

All other Modules

SilverStripe Forums » All other Modules » Newsletter Module

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2 3
Go to End
Author Topic: 2162 Views
  • Rossel
    Avatar
    Community Member
    18 Posts

    Re: Newsletter Module Link to this post

    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();
    }

  • benni91
    Avatar
    Community Member
    72 Posts

    Re: Newsletter Module Link to this post

    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 null

    what'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

    2162 Views
Page: 1 2 3
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.