Hello,

It would be really awesome to have the themed username used in the Your Name: Subject: and all parts of this module. This way if the a custom themed username is used, or if Realname module is used to override the themed username, then this name will be shown in the different fields instead of the username.

This would show Your name: Yaz instead of Your name: yaz085

Example from the print module on how this can be implemented here: http://drupal.org/node/572848

   if ($user->uid != 0) {
-    $user_name = $user->name;
+    $user_name = check_plain(strip_tags(theme('username', $user)));
     $form['fld_from_addr']['#default_value'] = $user->mail;
     $form['fld_from_addr']['#disabled'] = TRUE;
     $form['fld_from_addr']['#value'] = $user->mail;
-    $form['fld_from_name']['#default_value'] = $user->name;
+    $form['fld_from_name']['#default_value'] = $user_name;
   }

I hope this feature can make it into the forward module.

Thanks so much for this awesome module!

Comments

seanr’s picture

Status: Active » Postponed

That doesn't really work well in this case because we may or may not have an actual user object at our disposal - anonymous users enter their name manually, so we'd have no good way to handle that. If you can come up with a patch that works around that issue, I'm certainly open to the idea.

Bilmar’s picture

Status: Postponed » Active

Hi,

I'm a real beginner when it comes to programming but wanted to share some code from another module.
How about using global $user to check for the current user, then if the user is anonymous use the message with "(Your Name)" and when the user has a uid then use the themed username.

Does something like this work for the themed username:
$themed_name = check_plain(strip_tags(theme('username', $user)));
$form['message']['name']['#default_value'] = $themed_name;
$form['message']['subject']['#value'] = t('!name has forwarded a page to you from !site'', array('!name' => $themed_name));

Reference: http://drupal.org/node/792244

Thank you

Bilmar’s picture

Another reference from when Print module added themed username suppport.

http://drupal.org/node/572848

I hope this may be added to this module.

Thank you

john.oltman’s picture

Issue summary: View changes
Status: Active » Closed (outdated)