Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notification created without popup #13

Open
udriss opened this issue Apr 13, 2021 · 0 comments
Open

Notification created without popup #13

udriss opened this issue Apr 13, 2021 · 0 comments

Comments

@udriss
Copy link

udriss commented Apr 13, 2021

Hello.

Problematic moodle version 3.10.3+.

After installing the plugin, the notifications are created but not sent.
Indeed, by consulting the moodle database via the "mdl_notifications" table, I can see the creation of all the notifications, with the message chosen via the plugin.
However, this creation is not carried out in the "mdl_message_popup_notifications" table. It is the latter that allows their display.

By manually creating a new element using the INSERT TO command in the "mdl_message_popup_notifications" table, I was able to display a notification created via the external plugin and present in the "mdl_notifications" table.

In order to remedy this problem I added elements to the. "Local / resourcenotif / classes / notification.php" file by adding the code:

$ con = new PDO ('mysql: host = localhost; dbname = moodle', 'user', 'password');
$ command = $ con-> query ('SELECT MAX (id) FROM dl_notifications');
$ result = $ command-> fetch ();
$ write = "INSERT INTO `mdl_message_popup_notifications` (`notificationid`) VALUES ($ result [0])";
$ con-> query ($ write);

This code is added in the definition of the "public static function send_notification" function. I added the code after the if ($ res) { condition.

Thus, the right result is obtained.

For the database connection to work, I had to add use PDO; just after namespace local_resourcenotif;.

Do you have an other solution ?
Have you encounter this issue ?

Best regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant