Moodle plugin developer tutorial - build SQL to mark a message as read #7

preview_player
Показать описание
Here we build a more complex SQL query. We get messages that are not read by our current user, or not read by any user.

We use this query to decide in the before_footer hook whether to display any message to the end user.

Рекомендации по теме
Комментарии
Автор

Thank you so much for doing these tutorials.
I haven't caught your name, but I would like to thank you personally! Your style of teaching is incredibly informative and inspiring and I can't wait to follow the progress and keeping learning :)
You mentioned in one of your videos that we can support you in continuing to produce these tutorials. Please post where I could do so, as I am sure many of us are more than grateful for the time and knowledge you have given us. Please keep doing what you are doing!!!! Morgan 👍🏻🌈👏🏻

units
Автор

Thank you so much for sharing your knowledge. I have learned a lot from these videos. I will be waiting for the next video on Moodle. I would be very grateful if you could give me some videos on theme development

MuhammadRummanislamnur
Автор

I think there's an error in the SQL query that wants to find out which messages were read:

The query is (lib.php):

SELECT lm.id, lm.messagetext, lm.messagetype
FROM {local_message} lm
LEFT JOIN {local_message_read} lmr
ON lm.id = lmr.messageid
WHERE lmr.userid <> :userid OR lmr.userid IS NULL

This will return all messages that were read by someone else haven't been read by current user... but that's not what we want

Fixed:

SELECT *, lm.id, lm.messagetext, lm.messagetype
FROM {local_message} lm
LEFT JOIN {local_message_read} lmr
ON lm.id = lmr.messageid AND lmr.userid = :userid
WHERE lmr.userid IS NULL

This one joins only message_read lines that concern our current user - otherwise it will join NULL. That's exactly what we want.

flockomotion
Автор

This tutorial is very helpful! Thank you very much!

FotiosTsioumas
Автор

Thank you so much for your content. Could you please make an video how to build a custom profile field based on the average online time of the student by week? Would be awesome

benutzer-vp
Автор

Its easy to update table configuration that add new column as name "marked" and update when read message

nurullahcalskan
Автор

Thanks for this very interesting tutorial!
The plugin you use on vs code to access the DB is quite good. Which on is it?

patsej
Автор

Very good tutorial, the only one I have seen that way, everything is very clear. But I have a tasteless, because the ideal would have been to have prepared a complete crud, update and delete are missing ...

camiloandresmejiaortiz
Автор

developing a site on moodle. how do I contact you?

sleepEasy
Автор

Can you help me I want to know query Sql for making report belong to student attendance report
I want this information in the report
Studentdata. Day. Duration. From. To

mostafaibrahim
Автор

Can you help me? How i can login in moodle page login with select option and login, password?

dokturaka
join shbcf.ru