MyBB Community Forums

Full Version: MyAlerts v2.0.4
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
(2016-12-29, 12:57 PM)inTech Wrote: [ -> ]Hello there. I am currently developing a plugin and would like to extend MyAlerts with custom notification message whenever someone do something via my plugin. I searched the forums and the internet using Google and couldn't find any guide. Can you point anyone to the right direction?

Hi, this should help: https://github.com/MyBBStuff/MyAlerts/wi...ith-v2.0.0 Smile
(2016-12-29, 02:05 PM)Euan T Wrote: [ -> ]
(2016-12-29, 12:57 PM)inTech Wrote: [ -> ]Hello there. I am currently developing a plugin and would like to extend MyAlerts with custom notification message whenever someone do something via my plugin. I searched the forums and the internet using Google and couldn't find any guide. Can you point anyone to the right direction?

Hi, this should help: https://github.com/MyBBStuff/MyAlerts/wi...ith-v2.0.0 Smile

Thank you for the reference. I found it to be useful. I understand the first part of the guide (Adding an alert type). However I do not understand from that point onward. For example, where should I put my Alert Formatters code in? Thank you again.

Edit: After much testing I managed to get the custom alerts to show up. Thank you.

Where can I edit this text ("Hello") from my plugin and not a language file?

 return $this->lang->sprintf(
            "Hello",

Will it be possible for me to add in more parameters to customize the message more? I am currentely doing this:
 $outputAlert['from_user'] . " have sent you a gift.",

And the output is "Admin have sent you a gift.". I want it to be like "Admin have sent you a X". How can I pass 'X' to the MyAlerts function/class? I feel that it should be inside init() but I am not too sure.

Edit #2: After much testing and viewing MentionMe Github source, I managed to find out how can I insert customizable text into the alerts string. Thank you.

For anyone interested, you will need to use the setExtraDetails() method before you call the addAlert() method in your plugin. Then inside the formatter class, you will need to use the getExtraDetails() method to fetch the custom string from the database.
(2016-12-30, 06:46 AM)inTech Wrote: [ -> ]
(2016-12-29, 02:05 PM)Euan T Wrote: [ -> ]
(2016-12-29, 12:57 PM)inTech Wrote: [ -> ]Hello there. I am currently developing a plugin and would like to extend MyAlerts with custom notification message whenever someone do something via my plugin. I searched the forums and the internet using Google and couldn't find any guide. Can you point anyone to the right direction?

Hi, this should help: https://github.com/MyBBStuff/MyAlerts/wi...ith-v2.0.0 Smile

Thank you for the reference. I found it to be useful. I understand the first part of the guide (Adding an alert type). However I do not understand from that point onward. For example, where should I put my Alert Formatters code in? Thank you again.

Edit: After much testing I managed to get the custom alerts to show up. Thank you.

Where can I edit this text ("Hello") from my plugin and not a language file?

 return $this->lang->sprintf(
            "Hello",

Will it be possible for me to add in more parameters to customize the message more? I am currentely doing this:
 $outputAlert['from_user'] . " have sent you a gift.",

And the output is "Admin have sent you a gift.". I want it to be like "Admin have sent you a X". How can I pass 'X' to the MyAlerts function/class? I feel that it should be inside init() but I am not too sure.

Edit #2: After much testing and viewing MentionMe Github source, I managed to find out how can I insert customizable text into the alerts string. Thank you.

For anyone interested, you will need to use the setExtraDetails() method before you call the addAlert() method in your plugin. Then inside the formatter class, you will need to use the getExtraDetails() method to fetch the custom string from the database.

Sorry for the late reply, glad you managed to get it fixed. That's definitely the way to do it, here's an example formatter from the core: https://github.com/MyBBStuff/MyAlerts/bl...er.php#L21
Hey,

I noticed some people just simply refuse to use MyAlerts functions and after some point they get like " Alerts (1511) "

I see there's a task for automatically removing read alerts. But what about unread alerts? Those people simply do not read their alerts and honestly I don't want them to have thousand alerts. If it's possible I would really appreciate to have option such as "automatically removing alerts older than 3 months" or something similar.
Yeah, that's been requested before, and will be added whenever I get time to work on the next release. It definitely makes sense to add, because very few people would read more alerts than fit on a single page.
Hi Euan, where is the best place to download the plugin, from mybb or github?
(2017-01-25, 09:06 AM)Michael2014 Wrote: [ -> ]Hi Euan, where is the best place to download the plugin, from mybb or github?

GitHub, for definite. I haven't updated the version on the mods site in a long time!
Hi Euan, Is possible to update from mybb to github version?
Then you should probably add github link to first message, I am not sure if I have updated version or not.
(2017-01-25, 10:34 PM)insertco Wrote: [ -> ]Hi Euan, Is possible to update from mybb to github version?
So long as you have the current version from myBB, you just need to replace the files with the ones from GitHub.
(2017-01-25, 11:48 PM)Darkrad Wrote: [ -> ]Then you should probably add github link to first message, I am not sure if I have updated version or not.

Good point, will do so now.