Hi,
I'm putting together a local plugin that is successfully observing forum events (\mod_forum\event\discussion_created and \mod_forum\event\post_created), but the action I'm wanting to perform involves displaying a notice or dialog box to the user containing some of the forum object's data. I've tried using core notifications, jquery dialogs and plain js with no success, but I believe the issue is that none of these will work as the page refreshes as part of the action? Or am I doing something else incorrectly?
E.g.:
class local_verifycheck_observer {
public static function newPost(\mod_forum\event\post_created $event) {
echo '<script>confirm("Event Triggered and code executed."); </script>';
sleep(2);
}
}
The alert or dialog works for a more passive event such as Discussion viewed, so I'm guessing it's the page reload that's causing theh problem, but is there any way of addressing this?
Many thanks,
Paul