Tuesday, 13 August 2013

Debug Info from Moodle Plugin

Debug Info from Moodle Plugin

I am a newbie to Moodle. I am trying to create a local plug which would do
tasks (sending email) automatically when user is enrolled / unenrolled.
While developing this plugin, I am trying to echo or print_r some
information for debug and tracing purposes.
The code is as simple as
function perform_enrol($eventdata){
echo 'Hello World';
print_r($eventdata);
return true;
}
However, when the code executes, I get the following error occurs:
> Syntax Error File:
> http://192.168.10.60/moodle/theme/yui_combo.php?3.9.1/build/simpleyui/simpleyui.js&3.9.1/build/loader/loader.js
> Line: 18541
When I comment out the echo and print_r , the code works fine. The same
problem continues for print_object , debug or any other printing
functions.
Is there a specific way to print from plugins. I have used these functions
in core code in past and seems to work fine.

No comments:

Post a Comment