[development] user.module/user_register_submit and $merge_data['status']

Rob Koberg rob at koberg.com
Sat Aug 14 23:29:21 UTC 2010


Hi,

New to Drupal and relatively new to PHP.

I have been working on a COPPA module to constrain the registration
process on a non-profit site for young girls. COPPA is important
because it is a legal requirement to slightly filter the usage of a
web site by a person under 13 in the U.S (for any site that registers
users). I have looked at and tried:

http://drupal.org/project/coppa

I don't see it doing much, or perhaps it is under documented? Anyway,
I have two sets of users:

* over 13: These users can register, get an email, and access the site
right away

* under 13: These users are initially blocked. At registration time,
when it is determined they are under 13, a  lightbox comes up with
fields for the parent/guardian name, email and email confirm.

So I want two different settings for their /admin/user/settings/Public
registrations, blocked and not blocked. The code in user.module has:

if (!$admin) {
    // Set the user's status because it was not displayed in the form.
    $merge_data['status'] = variable_get('user_register', 1) == 1;
  }

I would like to have a way to block('administrator approval is
required')/unblock('no administrator approval is required') the user
based on age. I just use the "block('administrator approval is
required')" as a way to reuse the admin user settings emails. Actually
what happens is the parent is emailed an URL, and when they click it
the user's status is set to 1.

The only way I could see to do this (remember, newbie) was to change
the above user.module code to:

if (!$admin) {
    // Set the user's status because it was not displayed in the form.
    $merge_data['status'] = $form_state['status'] ?
$form_state['status'] : variable_get('user_register', 1) == 1;
  }

I realize this should not be in a site that does not control the
$form_state['status'], but is there some cleaner way to do this
without changing a base module?

thanks,
-Rob


More information about the development mailing list