How to send notifications from a plugin

I’d like to add new notifications in a plugin. They should be handled the same way as “official” notifications, respect the user settings, etc.

Is this possible and/or supported in any way? Any hint is greatly appreciated.

OK, I got it. But it was a really nice climb. :wink:

Thoughts on notifications

After digging a while, I came to the conclusion that it isn’t possible, at least not properly. Some facts:

  • All existing notifications are bound to task events. What if my plugin should issue a “neutral” notification, not bound to any task?

  • All existing notifications, their events, and event builders are hard-coded in the classes NotificationModel and NotificationSubscriber.

But wait, this is OOP, we can derive. In my current solution. I’ve installed my own NotificationModel, derived from the original and using my event builder. Further, I’ve installed my own Mailtype handler, to react to my events. For the type “web” I could use the original one. Everything works fine so far.

But what if another plugin wants to do something similar? I’m quite certain that this will break my solution. Is there any way out, writing plugin notifications without blocking other peoples solutions? I desperately hope, someone can help me out. Maybe @fred?

Any feedback is appreciated.