Problem/Motivation

At the moment, e-mail registration is invasive to all methods of creating an user account. This works great for an anonymous user registering an account, but perhaps an administrator would like to create internal user accounts via admin/people/create. E-mail Registration really should not apply to that page because that page is about creating users and not registering.

Proposed resolution

  • Add a permission to ignore form alter of user registration form.
  • Ignore alter of user registration form for admin/people/create always. This may be okay because that page is a restricted permission page anyway.

User interface changes

Allow creating and modifying user name property on admin/people/create, but not on user/register form.

Comments

mradcliffe’s picture

Status: Active » Needs review
StatusFileSize
new2.49 KB
new2.8 KB

Here are a couple of patches. First has a test.

This approach simply disables the functionality when user form "administer_users" value is set to TRUE. That made the most sense to me.

The last submitted patch, 1: 2424293-allow-user-name-for-admin-TESTONLY-1.patch, failed testing.

greggles’s picture

This makes sense to me. I'd like to leave it here for a bit for feedback on the concept in case anyone else has thoughts.

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

Beauty, just what I needed:)

mradcliffe’s picture

Probably needs a forward port patch to Drupal 8 as well.

joelpittet’s picture

Tagged for after commit.

andypost’s picture

Status: Reviewed & tested by the community » Needs work

The tests was broken, and refactored in commit 4278/57f

  1. +++ b/email_registration.test
    @@ -88,3 +88,68 @@ class EmailRegistrationTestCase extends DrupalWebTestCase {
    +  static public function getInfo() {
    ...
    +      'name' => t('Email registration (admin page)'),
    +      'description' => t('Assert that the user name form element is not hidden on admin create page.'),
    +      'group' => t('Email registration'),
    ...
    +    $this->assertFieldByXPath('//input[@name="name" and @type="text"]', t('User name field is not hidden on admin user create page.'));
    ...
    +    $this->assertEqual($new_account->name, $name, t('User name was set by administrator.'));
    

    t() should not be used here.

  2. +++ b/email_registration.test
    @@ -88,3 +88,68 @@ class EmailRegistrationTestCase extends DrupalWebTestCase {
    +    $this->assertRaw('<title>' . $name . ' | Drupal</title>', t('User properly created, logged in.'));
    

    there's $this->assertTitle()
    t() should not be used in assertions

The last submitted patch, 1: 2424293-allow-user-name-for-admin-1.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 1: 2424293-allow-user-name-for-admin-1.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review
StatusFileSize
new2.75 KB
new2.45 KB

Updated the patch thanks for the review @andypost.

Status: Needs review » Needs work

The last submitted patch, 11: 2424293-11.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

grevil’s picture

grevil’s picture

anybody’s picture

Status: Needs work » Closed (won't fix)

No more features for Drupal 7, sorry.