Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Newsletter Trouble


Go to End


3 Posts   1661 Views

Avatar
dio5

Community Member, 501 Posts

12 November 2007 at 11:36pm

Edited: 12/11/2007 11:48pm

Could be I overlooked something in the documentation, but I'm having trouble sending Newsletters.

Currently, I don't use the newsletter-signup form but have visitors auto-signedup when registered on the site.

The code I'm currently using for that is:

$newsRecipient = Object::create('Newsletter_Recipient');
$newsletter = DataObject::get_one("NewsletterType", "Title = 'Nieuws van Photoplaces'");
$newsRecipient->MemberID = $currentMemberID;
$newsRecipient->write();
$member->Groups()->add( $newsletter->GroupID );

$member is the $member that has just registered. So I have my members in 2 groups namely a frontend-user group and the group of the mailinglist.

This seems to work and I can see the member also as a member of the newsletter type in the cms.

The first question I have is: do I have to create a Newsletter_Recipient? Or isn't this necessary?

Secondly, I can't seem to send a newsletter. They don't arrive. (They are marked sent in the newsletter section though) Maybe this is because I have this Newsletter_Recipient created earlier?

And thirdly: when I want to add Members to the list manually, I get an error:

Warning: No form () returned by NewsletterAdmin->EditForm
At line 150 in /MYSITEROOT/sapphire/core/control/Controller.php

user_error(No form () returned by NewsletterAdmin->EditForm,512) line 150 of Controller.php Controller->run(Array) line 53 of Director.php Director::direct(admin/newsletter) line 101 of main.php

Error: Object::__call() Method 'callfieldmethod' not found in class 'NewsletterAdmin'
At line 190 in /MYSITEROOT/sapphire/core/Object.php

user_error(Object::__call() Method 'callfieldmethod' not found in class 'NewsletterAdmin',256) line 190 of Object.php Object->__call(callfieldmethod,Array) line of NewsletterAdmin->callfieldmethod(Array,) line 165 of Controller.php Controller->run(Array) line 53 of Director.php Director::direct(admin/newsletter) line 101 of main.php

Fourth question: am I correct that Newsletter templates still have to be in the mysite/templates/email directory in opposition to all the 'normal' email templates that can reside in themes/templates/email?

Any ideas?

Thanks!

mm.. there seems to be an issue with the code-formatting here... but I hope you get the issue.

Avatar
dio5

Community Member, 501 Posts

13 November 2007 at 12:15am

Edited: 13/11/2007 12:24am

Update:

I figured that doing

$member->Groups()->add( $newsletter->GroupID );

is probably enough and that creating this Newsletter_Recipient probably isn't necessary (the regular signup form doesn't seem to do this either)

When looking at the sent items in the cms, in the 'sent at' row there is 'none'.
Doesn't the newsletter stuff work when you have only 1 mailinglist member?

It works when I send a test mail though.

Avatar
dio5

Community Member, 501 Posts

13 November 2007 at 12:44am

Oh forget it... it was my mistake again, I messed up somewhere with the Unsubscribe-stuff...