Hi

First off, thanks for this great module!!

On my site, usernames are in numerical form and the real names stored in the profilefields profile_firstname and profile_lastname. Therefore I would very much appreciate the possibility to include those values profile field values in the activation email, in order to address my users with their real names.

Thank you very much, for taking my suggestion into consideration!

Regards,
Rob

CommentFileSizeAuthor
#2 user.module-D6.diff77 bytesfinfin82
#2 user.admin_.inc-D6.diff300 bytesfinfin82

Comments

dww’s picture

Title: Support for Profilefields » Support for profile fields in user email notifications
Project: User status change notifications » Drupal core
Version: 5.x-1.0 » 6.x-dev
Component: User interface » user system

now that user_status.module is part of D6 core (http://drupal.org/node/144859), moving this request to the core issue queue. if anyone's interested in seeing this before the D6 feature freeze, please assign this issue to yourself and work on a patch. however, i suspect the only real good way to do this would be if token API made it into D6 (http://drupal.org/node/113614) which seems unlikely at this point. :( so, perhaps this will have to wait for D7, unless someone wants to act fast and come up with a decent solution to D6 without all of token API.

finfin82’s picture

Status: Active » Needs review
StatusFileSize
new300 bytes
new77 bytes

In general i added the possibility to hook the token function to add you own user_mail_token.

this happens by adding a user_mail_tokens-hook to your module.

Also i changed the way how the email_token_help is handled by dynamicly outputting available tokens.

see attachment for diff-patches to the files and here is an example hook implementation.

/**
 * token für usermail erweitern
 *
 * @param $account useraccount
 *
 * @return $tokens = array(
    '!username' => $account->name,
    '!site' => variable_get('site_name', 'Drupal'),
    '!login_url' => user_pass_reset_url($account),
    '!uri' => $base_url,
    '!uri_brief' => preg_replace('!^https?://!', '', $base_url),
    '!mailto' => $account->mail,
    '!date' => format_date(time(), 'medium', '', NULL, $language->language),
    '!login_uri' => url('user', array('absolute' => TRUE, 'language' => $language)),
    '!edit_uri' => url('user/'. $account->uid .'/edit', array('absolute' => TRUE, 'language' => $language)),
  )
 *
 */
function minialter_user_mail_tokens($account) {
    $tokens = array();
    foreach($account as $key=>$value)
    {
        if(is_string($value)&&eregi("profile_",$key))
        $tokens['!'.$key] = $value;
    }
    return $tokens;
}

oh i guess i mixed up something while diffing (wrong order while calling the diff-files), please correct it ;-)

dww’s picture

Version: 6.x-dev » 7.x-dev
Status: Needs review » Postponed

a) New features will only get added to D7 (and even then, not many).

b) This is blocked on #554088: Move user_mail_tokens() and emails to token system which still has a chance of getting into D7.

sivaji_ganesh_jojodae’s picture

Version: 7.x-dev » 8.x-dev
Status: Postponed » Active

#554088: Move user_mail_tokens() and emails to token system is fixed now. Wish to see this at least in 8.x

dave reid’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.