Jump to:

10845 Posts in 2513 Topics by 1792 members

All other Modules

SilverStripe Forums » All other Modules » Extending the newsletter module

Discuss all other Modules here.

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

Page: 1
Go to End
Author Topic: 2281 Views
  • Nivanka
    Avatar
    Community Member
    395 Posts

    Extending the newsletter module Link to this post

    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?

  • MarcusDalgren
    Avatar
    Community Member
    288 Posts

    Re: Extending the newsletter module Link to this post

    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.

  • klikhier
    Avatar
    Community Member
    150 Posts

    Re: Extending the newsletter module Link to this post

    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!!!

  • Matze0681
    Avatar
    Community Member
    25 Posts

    Re: Extending the newsletter module Link to this post

    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!

  • MartinPhone
    Avatar
    Community Member
    51 Posts

    Re: Extending the newsletter module Link to this post

    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?

    2281 Views
Page: 1
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.