I've got a site where users do not create their own accounts. Users are notified that they have accounts by the email generated upon account creation, if the creator forgets to check the 'Notify user of new account' box, she cancels the account and creates it again--this time with the box checked. That box should be checked by default.

It should be possible for the creator to generate the password as a new random value and send a notification to the user.

Comments

vbouchet’s picture

Hi vgriffin,

I think the default value for the "Notify user of a new account" is something specific to each website.
You can very easily alter this default value via a hook_form_FORM_ID_alter(). Using the same hook, you can also fill password fields using the user_password() function which will generate a random password.

vgriffin’s picture

The default in the user.module code is not explicitly set, which sets the box to unchecked. The checkbox is only shown when an administrator is creating an account for a new user. Having the site send an email to the user is the easiest way to tell (possibly remote) users that they've got accounts. It's generally common sense to let users know about their new accounts. The ideal would be to configure the default setting as part of setup. Failing this, the form should default to making it easy for clerical staff to tell users about the new account. (One of the precepts of form design is to make it at least as easy for a user to enter correct values as incorrect values.)

The behavior I describe is general purpose enough that it should be provided by user.module code itself rather than by requiring site creators to write modules to alter forms created by a core Drupal module. You probably also know people who "know Drupal" but couldn't possibly write a working module!

Because I had to make the change quickly, my "workaround" was to provide only the change to the notify checkbox by inserting:

    '#default_value' => TRUE,

in the appropriate place in user.module.

dcam’s picture

Version: 7.34 » 8.0.x-dev
Component: user system » user.module

Feature changes must be made in the current development version, Drupal 8, then may be considered for backport.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

dpi’s picture

Status: Active » Closed (won't fix)

if the creator forgets to check the 'Notify user of new account' box, she cancels the account and creates it again this time with the box checked.

#5688: Resend welcome message from admin user/edit aims to provide a solution to this problem

That box should be checked by default.

I agree with #1, this is easily solvable by a contrib module which modifies the default value of that checkbox