Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
There is no open registration on my site so I would like to hide the Register link that displays at the top to anonymous users. In the past, I have just edited the function that returns those links at the top. I figured there must be a better way but I'm not sure how to do it. Would it be possible to check a variable to see whether user registration is restricted to administrators or not and only create the register link if new account creation is allowed on the site? Currently if someone clicks that link they get an Access Denied. I'd rather not display it at all. Thanks!
Comments
Comment #1
djg_tram CreditAttribution: djg_tram commentedSure, very easy (this might come late for you but others might still be interested). Just wrap the innards of the function in an if block:
if (variable_get('user_register', 0)) {}
Comment #2
thekurt CreditAttribution: thekurt commentedThanks djg_tram for the tip. I had the same issue.
In sites/all/themes/admire_grunge/template.php I changed this:
into this:
This works fine.
Kurt.