I am using Moodle 2.9.
I have added the messages block to a moodle site and made it show on every page of the site. But after the users recieve new messages on the system (they show in their messages area of their profiles) the block just says "No messages waiting"??
Is there a problem with this block or is there a setting somewhere in moodle to activate this?
Any advice on this would be great!
It seems that message sent directly through the messages area are appearing in the block, but I am using a message_send() function from an Activity Mod and those messages do not appear in the block, but they appear in the messages section? Is there some code I am missing out?
$message = new \core\message\message();
$message->component = 'moodle';
$message->name = 'instantmessage';
$message->userfrom = $userfrom;
$message->userto = $userto;
$message->subject = 'Test';
$message->fullmessage = 'Test.';
$message->fullmessageformat = FORMAT_HTML;
$message->fullmessagehtml = '<p>Text</p>';
$message->smallmessage = '';
$message->notification = '1';
$message->contexturl = '';
$message->contexturlname = '';
$message->replyto = "";
$content = '';
$messageid = message_send($message);
SOLVED
The messages block only shows messages that are set to not notify. So the notification object needs to be set to "0", it will not show a popup in Moodle but it will appear in the block.
Or you can change the block itself here to allow all messages to pass into the block no matter what the notification setting is: -
moodle\blocks\messages\block_messages.php
Change the SQL query on line 58 from: -
To