Extend Notification Send (email) functionality
  • I tried a form in settings which defines a email settings like smtp host etc.. and I succeeded in that but I want to extend send functionality in notification library. Can anyone give some idea on this this is my first day with fuelcms.
  • By notification library are you referring to the Fuel_notification library (which is essentially just a wrapper around the CI_Email class)?
  • Yes Fuel_notification library.
    "Send new user invite" functionality I wanted to extend.

    i.e. there is a form created via new module in settings for email settings which covers the fields like all email settings .. (from name, smtp, email etc...) which will be used to send email when the send function of file > modules\fuel\libraries\Fuel_notification.php is called.

    For that purpose I need to extend this library, but failed to do this. Just needed some guide/tips for this kind of functionality.

    Thanks.
  • You can extend the Fuel_notification library and then when you want to overwrite it, use the attach method. Example below:

    $my_notification = new MY_Notification();
    $CI->fuel->attach('notification', $my_notification);

  • Ok. Will try that.
  • Hello.
    I think I am getting very noob here.
    Let me explain my issue.
    Final Goal:
    When resetpassword/new invite is called it should also send email to admin who has different smtp details. So, I want to extend it.

    What I did:
    I have created a file in \application\libraries\MY_Notification.php which starts like...

    require_once(FUEL_PATH.'libraries/Fuel_notification.php');
    class My_notification extends Fuel_notification

    and this new file also do have a send function just like modules\fuel\libraries\Fuel_notification.php file has one.

    Now I was hoping that when send function is triggered, it will call from My_notification function and which is not getting called for obvious reason.

    But I am not getting how to solve it.


  • Where did you put the code:
    $my_notification = new MY_Notification();
    $CI->fuel->attach('notification', $my_notification);
  • I put in modules\fuel\libraries\Fuel_notification.php and didn't work. But 2 things I am sure that
    - that is the wrong location of the code
    - and there will/should not be any changes in Fuel_notification.php.
  • Try adding this to your fuel/application/config/MY_fuel.php file:
    $config['attach'] = array('notification' => new MY_Notification());

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!