I got the problem when using webform + realname.
When some user submits the form, webform submission is saved in webform table, with user uid.
After that, user is deleted from db, but form submission uid is still there. WHen admin looks through webform submissions, webform module calls theme('username'), with object (uid=%unexistend uid%, name = NULL), and realname creates a realname for that account, and the generated realname == '' (empty string)
after page refresh, realname doesn't recognize this db entry with empty string in realname table as a generated realname, and tries to insert new realname again, causing DB error ('duplicate entry')
To prevent this, I've changed realname_theme.inc on line 46:
if ($object->uid && empty($object->realname) && user_access('use realname')) {
to
if ($object->uid && $object->name && empty($object->realname) && user_access('use realname')) {

Comments

nancydru’s picture

Status: Active » Postponed (maintainer needs more info)

The user id should be adequate for getting the name values. Is the uid valid in this case?

nancydru’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

No further update