This is similar https://www.drupal.org/node/2302419. When you save a Profile2 profile, the user object gets passed with an empty username property and you get a duplicate entry error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'name': UPDATE {user}...

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

rob.costello’s picture

I'm not set up to create a proper patch, but a simple change will fix this. On line 50 of auto_username.module...
$form['account']['name']['#type'] = 'hidden';
could become...

if($form['#user_category'] === 'account'){
    $form['account']['name']['#type'] = 'hidden';
  }
fenstrat’s picture

Priority: Normal » Major
Status: Active » Needs review
FileSize
536 bytes

Yep, #1 is on the money, here it is in patch form.

Given that this totally breaks saving the user profile form with profile2 I'm upping the priority.

zhouhana’s picture

It works for me! Thank you!

Edit: Also see my comment at https://www.drupal.org/node/2661360#comment-11837562 Both patches solve my problem of not being able to save a Profile2 user profile.

Echofive’s picture

Version: 7.x-1.0-alpha1 » 7.x-1.0-alpha2

Still present in the 7.x-1.0-alpha2. The patch solve the issue.

fenstrat’s picture

Thanks for the feedback @Echofive, any chance you could mark this as RTBC?

zhouhana’s picture

Status: Needs review » Reviewed & tested by the community
nehajyoti’s picture

The patch looks to be fine, but seems to be outdated with the latest code to be applied. Patch is not getting applied.

nehajyoti’s picture

Status: Reviewed & tested by the community » Needs work