Skip to content

Instantly share code, notes, and snippets.

View sharpchi's full-sized avatar

Mark Sharp sharpchi

View GitHub Profile
@sharpchi
sharpchi / lib.php
Created June 23, 2021 07:35
Overriding a webservice for the Moodle activity chooser
/**
* A little something for your Moodle plugin to filter the activity chooser.
* @param object $function Details of the function to be called.
* @param array $params Parameters passed by the ajax call.
* @return boolean|array If the callback returns anything other than false, we assume it replaces the original function.
*/
function theme_mytheme_override_webservice_execution($function, $params) {
if ($function->name === 'core_course_get_course_content_items') {
$courseid = $params[0]; // This should be courseid.
$result = call_user_func_array([$function->classname, $function->methodname], $params);

Keybase proof

I hereby claim:

  • I am sharpchi on github.
  • I am marksharp (https://keybase.io/marksharp) on keybase.
  • I have a public key whose fingerprint is 8492 A2CC AD53 6FFF 16ED 9244 0326 98E8 8E70 FA47

To claim this, I am signing this object: