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.

All other Modules /

Discuss all other Modules here.

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

Extending the newsletter module


Go to End


6 Posts   3560 Views

Avatar
Nivanka

Community Member, 400 Posts

29 April 2009 at 3:22am

I am working on a website these days, for that I want to extend to Newsletter module mainly the newsletter class. The point is this, I want to add the latest blog posts on the newsletter. Now what I did was that I created a new class which extends the Newsletter. my class looks like this,

<?php

class ExtendedNewsletter extends Newsletter{
	
	function pages(){
		return DataObject::get("Page");
	}

}

?>

And I added this code in my /mysite/_config.php

Object::useCustomClass('Newsletter', 'ExtendedNewsletter');

now the problem is that whenever I create a new draft it creates a Newsletter Object, not a ExtendedNewsletter. Anyone can tell me what is wrong here, and do I need to use a DataObject decorater instead of extending the Newsletter class?

Avatar
MarcusDalgren

Community Member, 288 Posts

20 August 2009 at 8:36pm

What you're doing should work but it doesn't since they've hardcoded the class names in NewsletterAdmin.php. You basically have to rewrite NewsletterAdmin to call Object::getCustomClass(); to make sure it gets the right classes instead of the class names that have been hard coded in there.

I will probably be making these changes myself but I have already changed some stuff in the module to allow for multiple users without sharing newsletter types and automatic newsletter group generation for each newsletter type.

Avatar
klikhier

Community Member, 150 Posts

24 December 2009 at 5:26am

Dear Nivanka,

Did you get this to work, and... could you please post the exact steps towards the solution. I would like to add an image to the email template by adding an ImageField. Many thanks in advance!!!

Avatar
Matze0681

Community Member, 25 Posts

7 July 2010 at 2:14pm

Did anybody figure out how to extend the Newsletter module until now ? need to extend newletter as well. I need to make the generation of Mailinglists more flexible. For example get all Members as Recipiants which Gender is female.

thanks for help in advance!

Avatar
MartinPhone

Community Member, 57 Posts

14 October 2011 at 10:37am

Me too. Looking to add some fields to the newsletter. By randomly hacking around in the NewsletterAdmin I've managed to get my extended newsletter to appear but I really don't know what I'm doing.

Have tried a number of ways but none very fruitful. It's a bit sad that this module seems to be a little neglected - it could be so useful with some customisability! Anyone got anywhere?

Avatar
Frottello

Community Member, 2 Posts

27 August 2014 at 7:47pm

Hi All,
Although this post is quiet for a while I still wonder if the remark from Matze0681 has a follow up.

Maybe there is some documentation somewhere that I can't find right away. I would like some directions please.

Thanks already.