2

I'm trying to make a rather bullet proof front-end template that can toggle a sign up link based on if public registration is enabled or not.

Is there a way I can query to see if the system currently has public registration turned on from the front-end?

3

You can write a plugin that has a Template Variable that exposes Craft's SystemSettingsService->getSettings() method like so:

public function isPublicRegistrationEnabled()
{
    return craft()->systemSettings->getSetting('users', 'allowPublicRegistration');
}

You'd call it from the template via:

{% if craft.myAwesomePlugin.isPublicRegistrationEnabled() %}
    Enabled!
{% endif %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.