moodle/moodle · error · moodle_exception

notlocalisederrormessage

Error message

notlocalisederrormessage

What it means

Moodle's signup.php calls signup_is_enabled(); if no auth plugin with signup capability is enabled, it throws \moodle_exception('notlocalisederrormessage','error','','Sorry, you may not use this page.'). The 'notlocalisederrormessage' language string does not exist in error.php, so Moodle falls back to printing the fourth parameter as the raw message. In effect the page is telling the user that self-registration is disabled.

Solutions

  1. Set the correct signup auth: Site administration > Plugins > Authentication > Manage authentication, enable 'Email-based self-registration' (or another signup-capable plugin) and set it as self-registration method.
  2. Remove or fix $CFG->registerauth in config.php if it points at a disabled/nonexistent plugin.
  3. If self-registration is intentionally off, don't link users to /login/signup.php; hide signup links in the theme/auth settings.
  4. For testing, set $CFG->registerauth = 'email' and ensure the 'email' auth plugin is enabled.

Example fix

// before (config.php)
$CFG->registerauth = 'ldap'; // ldap has no signup / is disabled
// after
$CFG->registerauth = 'email'; // and enable Email-based self-registration in admin auth settings
Defensive patterns

Strategy: validation

Validate before calling

// before linking to signup.php
const enabled = await fetch(M.cfg.wwwroot + '/login/signup.php', { method: 'HEAD' });
if (!enabled.ok) hideSignupLink();
// or server-side: if (!get_auth_plugin($CFG->registerauth)->is_signup_enabled()) { redirect(new moodle_url('/login/index.php')); }

Try / catch

// server-side code that may redirect to signup
try {
    require_login();
} catch (moodle_exception $e) {
    if (debugging()) debugging('Signup unavailable: ' . $e->getMessage(), DEBUG_DEVELOPER);
    redirect(new moodle_url('/login/index.php'));
}

Prevention

When it happens

Trigger: Visiting /login/signup.php when the site's enabled signup auth plugin is missing or does not support signup: $CFG->registerauth is set to an auth plugin that is disabled, removed after an upgrade, or set to a plugin whose is_signup_enabled() returns false.

Common situations: Admins set $CFG->registerauth in config.php to an auth method (e.g. 'cas', 'shibboleth') that isn't enabled under Site administration > Plugins > Authentication; after upgrading Moodle an old registerauth value no longer exists; staging sites copied from production with registerauth pointing at a plugin unavailable locally.

Related errors


AI-assisted analysis of moodle/moodle@48ea8c3322 (2026-09-14). Data as JSON: /api/errors/c032d8d1f4b4c2c1. Report an issue: GitHub.

Appendix: source

Thrown at public/login/signup.php:33

// You should have received a copy of the GNU General Public License
// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.

/**
 * user signup page.
 *
 * @package    core
 * @subpackage auth
 * @copyright  1999 onwards Martin Dougiamas  http://dougiamas.com
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require('../config.php');
require_once($CFG->dirroot . '/user/editlib.php');
require_once($CFG->libdir . '/authlib.php');
require_once('lib.php');

if (!$authplugin = signup_is_enabled()) {
    throw new \moodle_exception('notlocalisederrormessage', 'error', '', 'Sorry, you may not use this page.');
}

$PAGE->set_url('/login/signup.php');
$PAGE->set_context(context_system::instance());

// If wantsurl is empty or /login/signup.php, override wanted URL.
// We do not want to end up here again if user clicks "Login".
if (empty($SESSION->wantsurl)) {
    $SESSION->wantsurl = $CFG->wwwroot . '/';
} else {
    $wantsurl = new moodle_url($SESSION->wantsurl);
    if ($PAGE->url->compare($wantsurl, URL_MATCH_BASE)) {
        $SESSION->wantsurl = $CFG->wwwroot . '/';
    }
}

if (isloggedin() and !isguestuser()) {
    // Prevent signing up when already logged in.

View on GitHub (pinned to 48ea8c3322)