The "To:" line of the personal contact form is supposed to display the username of the user whose contact page you're viewing. Instead it's blank (although the code appears to be correct and it works as expected in 4.7).

Patch simply removes the "To:" field from the form since it isn't working, and the username is already displayed as the page title anyways.

CommentFileSizeAuthor
#3 patch_36.txt817 byteswebernet
#2 patch_35.txt606 byteswebernet
patch_31.txt699 byteswebernet
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

webernet’s picture

Title: To field in contact module form always blank » To field in personal contact form always blank
Status: Needs review » Needs work

The original patch simply gets rid of the problematic code - of course, that's not the best solution - it should be fixed instead!

The page title set in contact_user_page() works as expected.

  drupal_set_title($account->name);
  $output = drupal_get_form('contact_mail_user');

The to line in contact_mail_user() doesn't.

$form['to'] = array('#type' => 'item',
  '#title' => t('To'),
  '#value' => $account->name,
);
webernet’s picture

Status: Needs work » Needs review
FileSize
606 bytes

I think I found the issue - $account was initialised in the parent function (contact_user_page()), but not in contact_mail_user(). Consequently the output was always blank.

Patch adds a line to initialize $account in contact_mail_user().

webernet’s picture

FileSize
817 bytes

Attached is a better patch which passes $account to the function, rather than recreating it.

webchick’s picture

Patch #3 does look cleaner, but is also an API change, so I'm not sure if it can be accepted.

chx says that it was a mistake that the function ended up not passing an argument, though... happened during the FAPI 2.0 conversion.

Dries’s picture

Status: Needs review » Fixed

Committed to CVS HEAD. Thanks.

Anonymous’s picture

Status: Fixed » Closed (fixed)