From 12a67a42664a7ccd22581c4abf5dc5aba384353a Mon Sep 17 00:00:00 2001 From: Marina Glancy Date: Fri, 24 Nov 2017 09:56:52 +0800 Subject: [PATCH] MDL-60887 registration: allow plugins to register on custom hubs --- admin/registration/confirmregistration.php | 8 ++++++++ admin/registration/renewregistration.php | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/admin/registration/confirmregistration.php b/admin/registration/confirmregistration.php index 6b20e8db068..7c9d422184b 100644 --- a/admin/registration/confirmregistration.php +++ b/admin/registration/confirmregistration.php @@ -46,6 +46,14 @@ $error = optional_param('error', '', PARAM_ALPHANUM); admin_externalpage_setup('registrationmoodleorg'); if ($url !== HUB_MOODLEORGHUBURL) { + // Allow other plugins to confirm registration on hubs other than moodle.net . Plugins implementing this + // callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration . + $callbacks = get_plugins_with_function('hub_registration'); + foreach ($callbacks as $plugintype => $plugins) { + foreach ($plugins as $plugin => $callback) { + $callback('confirm'); + } + } throw new moodle_exception('errorotherhubsnotsupported', 'hub'); } diff --git a/admin/registration/renewregistration.php b/admin/registration/renewregistration.php index 7926e0fc85f..84e727be323 100644 --- a/admin/registration/renewregistration.php +++ b/admin/registration/renewregistration.php @@ -40,6 +40,14 @@ $token = optional_param('token', '', PARAM_TEXT); admin_externalpage_setup('registrationmoodleorg'); if ($url !== HUB_MOODLEORGHUBURL) { + // Allow other plugins to renew registration on hubs other than moodle.net . Plugins implementing this + // callback need to redirect or exit. See https://docs.moodle.org/en/Hub_registration . + $callbacks = get_plugins_with_function('hub_registration'); + foreach ($callbacks as $plugintype => $plugins) { + foreach ($plugins as $plugin => $callback) { + $callback('renew'); + } + } throw new moodle_exception('errorotherhubsnotsupported', 'hub'); }