0

In Drupal 7, on my frontpage custom template, i want to show a text if the site is allowing new users to register. Any clues? Thanks

1
  • You can do a variable_get call in template.php to check the value of the registration state, but I can’t recall he name of the variable. It’s located in the variables database table. Based on that value you can create a new template variable to show a message.
    – Kevin
    Commented Jul 30, 2018 at 15:48

1 Answer 1

3

In a preprocess function for your template, add code something like:

$variables['is_registration_open'] = variable_get('user_register') == USER_REGISTER_VISITORS;

Then in your template:

<?php if ($is_registration_open) : ?>
<h3>Registration is open!</h3>
<?php endif; ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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