After installing the RealName module, I still get the username showing up in the emails sent by the OG notifications messaging template for group membership requests and new group content notifications. How do I get real-name for the current user and the node author for the OG messaging templates?

I use the following templates:

Membership request for '@group' from '@username'

To approve or deny this request, visit !approve_url.
You may approve or deny all requests and manage all members at !group_url.

Personal message from @username:
------------------

@request

and for new content:

Greetings, [user],

[type-name] '[title]' by [author-name]

[node-teaser]

Read more: [node-url]
Post reply: [site-url]/comment/reply/[nid]#comment-form

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tborrome’s picture

Title: Real-Name not showing up in OG notifications » Real-Name not showing up in email notifications
Priority: Normal » Critical

its not just OG notifcations. I do not see any real-name for other types of email notification such as the emails sent by the Signup and RSVP modules as well as Send Email action ... even the core's new user registration email sent does not show real-name. It works accross the site, but just not in email notifications. Any ideas how to get Real-Name to work for email notifications?

mstefanko’s picture

subscribing

bryancasler’s picture

Not sure if this is related, but it's possible.

I am giving the module in #433158: Automatically generate a username from realname fields. comment #60 a try and all except one important yet critical bug is working.

When my new user signs up they get the following email telling them their account is pending admin approval.

U4Y7gFn8N6,

Thank you for registering at...

Obviously the garbled mass of letters and numbers in the begining is supposed to be their name.

The good news is that when their account is finally approved, the email they then receive is fixed and contains their name.

roball’s picture

Title: Real-Name not showing up in email notifications » Add !realname token to email notifications from core (admin/user/settings)
Category: bug » feature
Priority: Critical » Normal

Would also love to see a !realname token for the "User e-mail settings" at "admin/user/settings".

bryancasler’s picture

Since this is getting no activity I am looking here as a possible work around http://drupal.org/node/792244#comment-2957484

bryancasler’s picture

YK85’s picture

Please help test and get committed #792244: Add !username_themed; replace Subscriptions' *_realname? It will definitely be a workaround until development is done here.
Thanks!

liquidcms’s picture

this works for me... a bit of a cludge as you would need to actually look up settings for realname to determine what fields are actually used to create the realname.

this is also based on logintobbogan being there for the std user register email (i.e. need a different case for if that module is disabled.

// Allow use of !realname token in user activation emails
function mymodule_mail_alter(&$message) {
  switch ($message['id']) {
    case "user_register_admin_created":
    case "logintoboggan_register_no_approval_required":
      $name = trim($_POST['field_profile_fname'][0]['value']) . " " . trim($_POST['field_profile_lname'][0]['value']); 
      $message['subject'] = str_replace('!realname', $name, $message['subject']);  
      $message['body'] = str_replace('!realname', $name, $message['body']); 
      break;
  }  
}
manuel.adan’s picture

Version: 6.x-1.3 » 6.x-1.4
Status: Active » Needs review
FileSize
2.43 KB

Hi,

The attached patch for version 1.4 tries to solve it, adding a new !realname token. I only use content_profile, so it has not been tested for core profile module. It is also aware of logintoboggan module if present. However, in new user account creation, realname_make_name function returns an arbitrary string (as cited in #3), so this patch does not work correctly in such cases.

Status: Needs review » Needs work

The last submitted patch, realname_token_system_mail_notifications.patch, failed testing.

kevinquillen’s picture

None of the patches are working for me. How can I change the welcome email when a user registers? The site I am working on abstracts usernames completely, so I would like to see RealName replace username everywhere. I can't seem to change the outgoing mails.

kevinquillen’s picture

In #9, it makes reference to message['body'][0] whereas #8 uses only $message['body']. After commenting out the str_replace on the body in #9, the solution in #8 works for me.

I can't seem to get #9 to work for me at least in the case of the Welcome message.

StevenJay’s picture

This modification works for me. I have added all the op codes so it should replace the token !realname in the subject and body of all the user emails with the realname. Change HOOK to your module name.

function HOOK_mail_alter(&$message) {
  switch ($message['id']) {
    case "user_register_admin_created": 
    case "user_register_no_approval_required":  
    case "user_register_pending_approval":
    case "user_password_reset":  
    case "user_status_blocked":
    case "user_status_deleted":
    case "logintoboggan_register_no_approval_required":  
      $name = (isset($message['params']['account']->realname)) ? $message['params']['account']->realname : '';
      $message['subject'] = str_replace('!realname', $name, $message['subject']); 
      $message['body'] = str_replace('!realname', $name, $message['body']);
      break;
  } 
}
roball’s picture

Would you like to provide this as a patch for the RealName module?

azin’s picture

Status: Needs work » Needs review
gillisig’s picture

#9 is not working for me and not #13 either.. #13 just replaces !realname with the normal username.

tobiberlin’s picture

Did anyone get this to work? I still can not get the realname into the users confirmation email after registration

tobiberlin’s picture

Adding:

for me it works when I use Mail Editor module - and core profile module fields for defining the first and last name. When realnames are calculated out of fields from profile core module I get the wished result - if I use CCK fields from a content profile node which is filled in during registration the username for logging in is used in the confirmation mail.

Best,
Tobias

zany’s picture

See the token_registration_mails module for genuine Token support.

hass’s picture

Issue summary: View changes
Status: Needs review » Closed (outdated)