'

MKP Base Notifications

Notifications are messages that popup in the lower right corner of the screen to inform the user. There are many types of notifications from “System Error” (the worst!) to “Confirmation” that informs the user that something they did was completed.

Notifications can be generated from within PHP code on the server or from JavaScript code on the browser. Notifications generated by PHP code are stored in a database table. They can be extracted and displayed by either PHP code or by JavaScript (jQuery) code that makes an AJAX call to the server which retrieves the messages from the database and sends them back to the browser where the browser code then displays the messages as popup messages on the bottom right corner of the screen.
Here is an example of how to create notifications using the mkp_base shortcode:

mkp_base verbose notification_types
mkp_base message=”This is a notification message” type=3 sticky notify
mkp_base message=”There is a severe system error. Melt-down is imminent!”, type=1, sticky notify
mkp_base message=”You did good son!” type=4 notify
mkp_base show_notifications
mkp_base clear_notifications

Output:

Errors found in shortcode - cannot proceed.



2019-12-15 03:29:08: [warning] STICKY = 2 errors detected:
2019-12-15 03:29:08: [error] STICKY = [notification_types] is not a valid shortcode
2019-12-15 03:29:08: [error] STICKY = No action code found
2019-12-15 03:29:08: [warning] STICKY = This is a notification message
2019-12-15 03:29:08: [system] STICKY = There is a severe system error. Melt-down is immanent!
2019-12-15 03:29:08: [confirmation] NOT STICKY = son!

Notifications cleared