MDL-57102 auth: Add new signup_is_enabled function

And apply the function in:
- login/signup.php
- blocks/login/block_login.php
This commit is contained in:
Juan Leyva
2016-11-23 19:35:08 +00:00
parent cd4a6b8b0b
commit 813320fbb6
4 changed files with 25 additions and 11 deletions
+18
View File
@@ -916,3 +916,21 @@ function signup_get_user_confirmation_authplugin() {
}
return $authplugin;
}
/**
* Check if sign-up is enabled in the site. If is enabled, the function will return the authplugin instance.
*
* @return mixed false if sign-up is not enabled, the authplugin instance otherwise.
* @since Moodle 3.2
*/
function signup_is_enabled() {
global $CFG;
if (!empty($CFG->registerauth)) {
$authplugin = get_auth_plugin($CFG->registerauth);
if ($authplugin->can_signup()) {
return $authplugin;
}
}
return false;
}