Anyone got good experience of output callbacks I can tap for some help...

Anyone got good experience of output callbacks I can tap for some help...

by Jock Coats -
Number of replies: 0

At the moment we have quite a clunky requirement where if someone hasn't paid their fees, or also now completed their enrolment, at the very last stage before they are removed as a student (which is apparently difficult to reverse in our SRS hence wanting to try everything to get people's attention to fix it before they get cut off), the relevant department creates a hold record in the SRS and I use that in my nightly enrolment synchronisations to enrol or unenrol them (when the issue is fixed) on a hidden course, We then put some javascript in the additional html screens in admin to call a particular plugin which goes through the process of determining whether they are enrolled on that course (and does this on every page load) and if so injects a bit of Javascript to send them to a static "service is withdrawn reason" page about how to fix it and regain Moodle access.

But we recently discovered callback hooks, and we figured that if we stored this information instead in a hidden profile field, it would be right there in the $USER object and much more efficient to check - and enable us to update the status more or less live by listening for "holds" API messages on our SRS.

But I wanted to "host" it all on Moodle instead of pointing out to another server with a static page on it.

So at the moment in a new plugin, we are listening for those messages and updating profiles as hey get changed in SRS, then I am using the before_standard_top_of_body_html callback to do a quick check on the profile field and if so I would like to inject html and/or javascript that would display a message a little like the "confirm logout" message - with no navigation - just header and footer round it, and essentially forcing them to go to login/logout.php

I have it working with the old method - of injecting a little Javascript to send them off to another URL. But is there any way, for instance of calling "login/logout.php" and over-riding the "confirm" message, or just rendering a page with no navigation just the header and the rest of the footer inside my plugin_name_before_standard_top_of_body_html function with no option but to logout afterwards?

Any ideas welcome. Quite urgent, though because I can at least make it to as it does now I can cope for a short while.

On a more general front, does anyone know of any places with good examples or recipes of using output callback hooks in moodle?

Best wishes,

Jock

Average of ratings: -