I know I can simply create a db_query statement and change the database entry to disable visitor registration, but I know that for many tasks direct database manipulation is unnecessary.

Is there a variable_set value that would turn off visitor registration so that only admins can create user accounts automatically?

I'm still learning install profiles, but from what I understand it seems to be much cleaner/safer to use built-in functionality rather than manually editing the tables.

Comments

scoutbaker’s picture

---
"Nice to meet you Rose...run for your life." - The Doctor
My first public Drupal site - EyeOnThe503

jgaryt’s picture

Through Drupal Administration, go to "/admin/user/settings", set "Public Registrations" option to "Only site administrators can create new user accounts."

you can also turn off the "login" box by going to "/admin/build/block/list" and setting "Region" to "None". Then when you need to log in, just go to "yourdrupalsite.com/user" or "yourdrupalsite/?q=user" if you are not using clean URLs.

-
jgaryt

mcaden’s picture

You missed the "Install Profile" part of the problem.

!Solved!

There IS a variable for this. I found it by perusing the "variable" table of a working drupal installation. This actually helped me on install profiles more than any of the drupal API documentation.

variable_set('user_register',0);

Appreciate the help though.

rodrigobb’s picture

Actually there's a constant to use here
variable_set('user_register', USER_REGISTER_ADMINISTRATORS_ONLY)

It's defined in user.module