I feel the default for User module should be to always 'Notify user of new account' when admin creates a new user. This way admin must choose NOT to send the notice when creating the new user. This matches the non-admin behavior of user registration and prevents the oversight of the send notice option and the one use login not being available to the new user.

xjm disagrees (#17).

Files: 
CommentFileSizeAuthor
#25 notify-user-of-new-account-by-default_691294-25.patch1.36 KBdevert
#24 notify-user-of-new-account-by-default_691294-24.patch1.36 KBdevert
#14 notify-user-of-new-account-by-default_691294-14.patch1.4 KBPawelR
PASSED: [[SimpleTest]]: [MySQL] 53,427 pass(es). View
#10 notify-user-of-new-account-by-default_691294-10.patch1.41 KBPawelR
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/modules/user/lib/Drupal/user/AccountFormController.php. View
#7 notify-user-of-new-account-by-default_691294-7.patch1.41 KBPawelR
PASSED: [[SimpleTest]]: [MySQL] 52,201 pass(es). View
#5 notify-user-of-new-account-by-default_691294-5.patch611 bytesPawelR
FAILED: [[SimpleTest]]: [MySQL] 52,216 pass(es), 1 fail(s), and 0 exception(s). View
#3 notify-user-of-new-account-by-default_691294-2.patch582 bytesPawelR
FAILED: [[SimpleTest]]: [MySQL] 52,206 pass(es), 6 fail(s), and 0 exception(s). View
#1 691294-notify-user-of-new-account-by-default.patch425 bytesDevin Carlson
FAILED: [[SimpleTest]]: [MySQL] 33,637 pass(es), 4 fail(s), and 0 exception(es). View

Comments

Devin Carlson’s picture

Status: Active » Needs review
FileSize
425 bytes
FAILED: [[SimpleTest]]: [MySQL] 33,637 pass(es), 4 fail(s), and 0 exception(es). View

I agree, having the checkbox checked by default would be a nice little usability improvement. I can't think of many situations in which you would want to create more users without notifying them than users with notifying them.

The attached patch changed the checkbox to checked by default.

Status: Needs review » Needs work

The last submitted patch, 691294-notify-user-of-new-account-by-default.patch, failed testing.

PawelR’s picture

Status: Needs work » Needs review
FileSize
582 bytes
FAILED: [[SimpleTest]]: [MySQL] 52,206 pass(es), 6 fail(s), and 0 exception(s). View

Attached patch working with AccountFormController.

Status: Needs review » Needs work

The last submitted patch, notify-user-of-new-account-by-default_691294-2.patch, failed testing.

PawelR’s picture

Status: Needs work » Needs review
FileSize
611 bytes
FAILED: [[SimpleTest]]: [MySQL] 52,216 pass(es), 1 fail(s), and 0 exception(s). View

I was surprised that following tests failed:

OpenIDRegistrationTest
UserAdminTest
UserRegistrationTest
UserRolesAssignmentTest

I would expect that this patch could affect only UserCreateTest.
I've found that user (self) registration logic is based on default value of this checkbox which IMHO should only be used only when administrator creates an account.

class RegisterFormController extends AccountFormController {
...
public function save(array $form, array &$form_state) {
...
$notify = !empty($form_state['values']['notify']);
....
$op = $notify ? 'register_admin_created' : 'register_no_approval_required';

I created new patch with walk around but maybe it would be worth to consider a change in registration workflow logic which would not rely on default value of this checkbox.

Status: Needs review » Needs work

The last submitted patch, notify-user-of-new-account-by-default_691294-5.patch, failed testing.

PawelR’s picture

Status: Needs work » Needs review
FileSize
1.41 KB
PASSED: [[SimpleTest]]: [MySQL] 52,201 pass(es). View

missed one test

noels’s picture

Status: Needs review » Reviewed & tested by the community

All user and OAuth tests pass.

catch’s picture

Status: Reviewed & tested by the community » Needs work
+      '#default_value' => $register && $admin ? TRUE : NULL,

What not just $register && $admin? FALSE should be fine there.

PawelR’s picture

Status: Needs work » Needs review
FileSize
1.41 KB
FAILED: [[SimpleTest]]: [MySQL] Invalid PHP syntax in core/modules/user/lib/Drupal/user/AccountFormController.php. View

Status: Needs review » Needs work

The last submitted patch, notify-user-of-new-account-by-default_691294-10.patch, failed testing.

PawelR’s picture

Status: Needs review » Reviewed & tested by the community

I tried suggestion in #9 but test failed because of that change. It's invalid valid PHP syntax.
I'm sorry, I misread #9.

PawelR’s picture

PawelR’s picture

Status: Needs work » Needs review
FileSize
1.4 KB
PASSED: [[SimpleTest]]: [MySQL] 53,427 pass(es). View
dudycz’s picture

Straightforward change, looks better now without TRUE : NULL.

xjm’s picture

xjm’s picture

Status: Reviewed & tested by the community » Needs work

Hmm, a few things:

  1. I actually disagree with this change. I almost never want to send emails to users. In general, sending email by default is a bad idea. Let's get more feedback on this change.
  2. The change we're making in testCreateUserWithRole() seems a bit simplistic to me. Instead of changing the test to assert a message for a different setting than what the test is testing, let's instead set the configuration we want explicitly in the test.
dudycz’s picture

I think that change is nice usability improvement.
In general I also think sending emails to users is a bad idea but not in this case.
Here we are talking about creating their accounts, this email contains information how to use it.
It's a very good idea to send an email in this particular case.

xjm’s picture

Here we are talking about creating their accounts, this email contains information how to use it.
It's a very good idea to send an email in this particular case.

It's sometimes a good idea to do so, but IMO it's never a good idea when the site owner didn't intentionally configure it to do so.

jsgammato’s picture

I'd love to see a switch to make it admin-configurable. Clearly many people want it, but others do not. It would be great if each of us could select for ourselves the default value for our sites.
I want it. It's frustrating to forget to check it and finish creating a user only to have missed the chance to notify the user automatically.

jsgammato’s picture

Issue summary: View changes

Updated issue summary.

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.

dpi’s picture

Issue summary: View changes
Status: Needs work » Closed (won't fix)
devert’s picture

Though this issue is closed, I would still like this functionality on a project. Updating the patch to work correctly with latest 8.2.x dev branch.

devert’s picture

Re-roll of patch to make a tweak to the assertText test in UserRolesAssignmentTest.php