diff --git a/mollom.module b/mollom.module
index 6b26955..467a4aa 100644
--- a/mollom.module
+++ b/mollom.module
@@ -1094,61 +1094,58 @@ function mollom_form_get_values(&$form_state, $fields, $mapping) {
     $data['postBody'] = $post_body;
   }
 
-  // User name.
+  // Author ID.
+  // If a non-anonymous user ID was mapped via form values, use that.
+  if (!empty($mapping['author_id'])) {
+    $data['authorId'] = $mapping['author_id'];
+  }
+  // Otherwise, the currently logged-in user is the author.
+  elseif (!empty($user->uid)) {
+    $data['authorId'] = $user->uid;
+  }
+
+  // Load the user account of the author, if any, for the following author*
+  // property assignments.
+  $account = FALSE;
+  if (isset($data['authorId'])) {
+    $account = user_load($data['authorId']);
+  }
+
+  // Author name.
+  // A form value mapping always has precedence.
   if (!empty($mapping['author_name'])) {
     $data['authorName'] = $mapping['author_name'];
-    // Try to inherit user from author name.
-    $account = user_load_by_name($data['authorName']);
   }
-  elseif (!empty($user->name)) {
-    $data['authorName'] = $user->name;
+  // In case a post of a registered user is edited and a form value mapping
+  // exists for author_id, but no form value mapping exists for author_name,
+  // use the name of the user account associated with author_id.
+  // $account may be the same as the currently logged-in $user at this point.
+  elseif (!empty($account->name)) {
+    $data['authorName'] = $account->name;
   }
 
-  // User e-mail.
+  // Author e-mail.
   if (!empty($mapping['author_mail'])) {
     $data['authorMail'] = $mapping['author_mail'];
   }
-  elseif (!empty($data['author_name'])) {
-    if (!empty($account->mail)) {
-      $data['authorMail'] = $account->mail;
-    }
-  }
-  elseif (!empty($user->mail)) {
-    $data['authorMail'] = $user->mail;
+  elseif (!empty($account->mail)) {
+    $data['authorMail'] = $account->mail;
   }
 
-  // User homepage.
+  // Author homepage.
   if (!empty($mapping['author_url'])) {
     $data['authorUrl'] = $mapping['author_url'];
   }
 
-  // User ID.
-  if (!empty($mapping['author_id'])) {
-    $data['authorId'] = $mapping['author_id'];
-  }
-  elseif (!empty($data['author_name'])) {
-    if (!empty($account->uid)) {
-      $data['authorId'] = $account->uid;
-    }
-  }
-  elseif (!empty($user->uid)) {
-    $data['authorId'] = $user->uid;
-  }
-
-  // User OpenID.
+  // Author OpenID.
   if (!empty($mapping['author_openid'])) {
     $data['authorOpenid'] = $mapping['author_openid'];
   }
-  elseif (!empty($data['author_id'])) {
-    if (!empty($account->uid) && ($openid = _mollom_get_openid($account))) {
-      $data['authorOpenid'] = $openid;
-    }
-  }
-  elseif (!empty($user->uid) && ($openid = _mollom_get_openid($user))) {
+  elseif (!empty($account) && ($openid = _mollom_get_openid($account))) {
     $data['authorOpenid'] = $openid;
   }
 
-  // User IP.
+  // Author IP.
   $data['authorIp'] = ip_address();
 
   // Honeypot.
diff --git a/tests/mollom.test b/tests/mollom.test
index 388d540..af4d22d 100644
--- a/tests/mollom.test
+++ b/tests/mollom.test
@@ -3012,6 +3012,7 @@ class MollomDataTestCase extends MollomWebTestCase {
     );
     $form_state = array('values' => $values, 'buttons' => array());
     $data = mollom_form_get_values($form_state, $fields, $form_info['mapping']);
+    $data += array_fill_keys(array('postTitle', 'postBody', 'authorId', 'authorName', 'authorMail', 'authorUrl', 'authorOpenid', 'authorIp'), NULL);
 
     $this->assertSame('postTitle', $data['postTitle'], $values['subject']);
     $body = array(
@@ -3021,11 +3022,48 @@ class MollomDataTestCase extends MollomWebTestCase {
       $values['field_checked'][1]['value'],
     );
     $this->assertSame('postBody', $data['postBody'], implode(" \n", $body));
+    $this->assertSame('authorId', $data['authorId'], NULL);
     $this->assertSame('authorName', $data['authorName'], $values['name']);
     $this->assertSame('authorMail', $data['authorMail'], $values['mail']);
-    $this->assertFalse(isset($data['authorUrl']), t('authorUrl: Undefined.'));
-    $this->assertFalse(isset($data['authorOpenid']), t('authorOpenid: Undefined.'));
-    $this->assertFalse(isset($data['authorId']), t('authorId: Undefined.'));
+    $this->assertSame('authorUrl', $data['authorUrl'], NULL);
+    $this->assertSame('authorOpenid', $data['authorOpenid'], NULL);
+    $this->assertSame('authorIp', $data['authorIp'], ip_address());
+
+    // Verify submitted form values for an anonymous user whose name happens to
+    // match a registered user.
+    $values = array(
+      'subject' => 'Foo',
+      'message' => 'Bar',
+      'parent' => array(
+        'child' => 'Beer',
+      ),
+      'field_checked' => array(
+        0 => array('value' => 'Check first'),
+        1 => array('value' => 'Check second'),
+      ),
+      'field_unchecked' => array(
+        0 => array('value' => 'Ignore first'),
+        1 => array('value' => 'Ignore second'),
+      ),
+      'name' => $this->admin_user->name,
+    );
+    $form_state = array('values' => $values, 'buttons' => array());
+    $data = mollom_form_get_values($form_state, $fields, $form_info['mapping']);
+    $data += array_fill_keys(array('postTitle', 'postBody', 'authorId', 'authorName', 'authorMail', 'authorUrl', 'authorOpenid', 'authorIp'), NULL);
+
+    $this->assertSame('postTitle', $data['postTitle'], $values['subject']);
+    $body = array(
+      $values['message'],
+      $values['parent']['child'],
+      $values['field_checked'][0]['value'],
+      $values['field_checked'][1]['value'],
+    );
+    $this->assertSame('postBody', $data['postBody'], implode(" \n", $body));
+    $this->assertSame('authorId', $data['authorId'], NULL);
+    $this->assertSame('authorName', $data['authorName'], $values['name']);
+    $this->assertSame('authorMail', $data['authorMail'], NULL);
+    $this->assertSame('authorUrl', $data['authorUrl'], NULL);
+    $this->assertSame('authorOpenid', $data['authorOpenid'], NULL);
     $this->assertSame('authorIp', $data['authorIp'], ip_address());
 
     // Verify submitted form values for an registered user.
@@ -3037,15 +3075,15 @@ class MollomDataTestCase extends MollomWebTestCase {
     );
     $form_state = array('values' => $values, 'buttons' => array());
     $data = mollom_form_get_values($form_state, $fields, $form_info['mapping']);
+    $data += array_fill_keys(array('postTitle', 'postBody', 'authorId', 'authorName', 'authorMail', 'authorUrl', 'authorOpenid', 'authorIp'), NULL);
 
     $this->assertSame('postTitle', $data['postTitle'], $values['subject']);
     $this->assertSame('postBody', $data['postBody'], $values['message']);
+    $this->assertSame('authorId', $data['authorId'], $this->admin_user->uid);
     $this->assertSame('authorName', $data['authorName'], $this->admin_user->name);
     $this->assertSame('authorMail', $data['authorMail'], $this->admin_user->mail);
-    $this->assertFalse(isset($data['authorUrl']), t('authorUrl: Undefined.'));
-    // @todo Test this.
-    $this->assertFalse(isset($data['authorOpenid']), t('authorOpenid: Undefined.'));
-    $this->assertSame('authorId', $data['authorId'], $this->admin_user->uid);
+    $this->assertSame('authorUrl', $data['authorUrl'], NULL);
+    $this->assertSame('authorOpenid', $data['authorOpenid'], NULL);
     $this->assertSame('authorIp', $data['authorIp'], ip_address());
 
     // Verify that invalid UTF-8 is detected.
