Well, for starters if you're gonna be adding a custom alert, you should add an option for users to be able to disable/enable it in the profile notifications area, you can do that with the integrate_alert_types hook which is called from Profile-Modify.php line 2080

As for sending out the alert, the proper way of doing it is to create a background task like so

After that you go ahead and create your class located under $sourcedir/tasks, this is where the alerts and/or emails will be sent/inserted.Note that you will be able to access the json formatted array through the background tasks's $_details attribute.

Having a look at that MsgReport-Notify.php as you mentioned.I've got my alert working. However, for that particular alert (MsgReport-Notify) you guys seem to be cheating as the txt string has a different text on 2 different language files.

Is there a parameter we could use to set a different language string so I can have both strings on the same language file?I'm referring to the setting txt string for enabling/disabling the alert in profile and the one that actually appears in the alert.

You don’t technically *need* a background task. If you’re doing something where you’re not checking the user’s preference and realistically only sending one at a time, just insert into the alerts table and call updateMemberData to bump the alerts count.

The background task is only to push it outside of the code where you’re doing the work so it can return to the user faster - in 2.0 if people have notifications set up on a topic “instantly”, that gets done immediately on posting which is why on some sites it can take a while to return to topic once done. In 2.1 this whole thing can be safely punted out to the background tasks and the main process can return to the user immediately.

You could, provided you're willing to accept the hit of working out if the user should get an alert in the same page load. The whole deal of background tasks is to move the processing to where the normal users won't see it so it won't slow down page loads for them.