Test if Anonymous users can sign up for a new account In a Drupal theme, how can you test if Anonymous users are able to sign up for a new account?

Background:

I am theming my user login form according to this tutorial. 

On my themed user loser login form, there is an option for users to sign up if they do not have account. 

On my site, I periodically disable anonymous sign ups, so when this happens, I want the sign up link in my theme to be not printed out.
If you look at the implementation of the login block in the core user module:

$items = array();
if (variable_get('user_register', USER_REGISTER_VISITORS_ADMINISTRATIVE_APPROVAL)) {
  $items[] = l(t('Create new account'), 'user/register', array('attributes' =&gt;
    array('title' =&gt; t('Create a new user account.'))));
}


you'll see that it queries a variable name user_register. If you disable anonymous registration, this becomes 0, and the link to "Create a new account" doesn't show.

This logic should work, no matter how you theme your site.

If your theme breaks this logic in the core user module, then you need to rework your theme until it don't break the core user module.

(Btw - this also tells you how to "test if Anonymous users are able to sign up for a new account" - check the status of the user_register variable, and if it is non-zero they should be able to sign up.  But this does not belong in your theme.  It belongs where it already is: In the core user module. I will advice against putting it in the theme.)