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

Rob Koberg rob at koberg.com
Mon Aug 16 01:36:11 UTC 2010


Bueller?

Based on how a user registers, how can I set one group of users to be
blocked after registration and another group that is not blocked?

The current code is:

$merge_data['status'] = variable_get('user_register', 1) == 1;

so there is no way to allow for more than one 'Public registrations'.
I have seen loggintobaggan. Perhaps there could be a setting to allow
a filter to provide access.

$merge_data['status'] = $form_state['status'] ? $form_state['status']
: variable_get('user_register', 1) == 1;

Or is there some other way than modifying the core to prevent
$merge_data['status'] = variable_get('user_register', 1) == 1; ? Is it
possible to completely override the user_register_submit() somehow?

-Rob

On Sat, Aug 14, 2010 at 4:29 PM, Rob Koberg <rob at koberg.com> wrote:
> 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