Moodle putting up notification

PHP Code to provide notification on redirection

$message = 'Message on redirect';
 redirect('/index.php', $message, null, \core\output\notification::NOTIFY_SUCCESS);

   // Or use the following helper functions:
   \core\notification::error($message);
   \core\notification::warning($message);
   \core\notification::info($message);
   \core\notification::success($message);

JS Code for notification

require(['core/notification'], function(notification) {
    notification.alert('Hello', 'Welcome to my site!', 'Continue');
});

Leave a Reply

Your email address will not be published. Required fields are marked *