Email Message configuration for forgot password

2019-09-02 17:49发布

问题:

I am using joomla's default login module. In forgot module section, I have added one more column called username. Now how shall I send this username along with the token id in the mail? Please help me.

Thanks in advance.

回答1:

Open the following folder:

root/components/com_user/models/reset.php

Joomla 2.5

Lines 383 to 388, change this:

$body = JText::sprintf(
    'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
    $data['sitename'],
    $data['token'],
    $data['link_text']
);

to this:

$body = JText::sprintf(
    'COM_USERS_EMAIL_PASSWORD_RESET_BODY',
    $data['fromname'], //added data type to get the username
    $data['sitename'],
    $data['token'],
    $data['link_text']
);

Joomla 1.5

On line 256, change this:

$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $token, $url);

to this:

$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $fromname, $token, $url);


回答2:

This is incorrect;

$data['fromname'], //added data type to get the username

This should read ;

$data['**username**'], //added data type to get the username

Also dont forget you will also need to modify the language string for this email to include and extra %s.

So in you email it will now read;

%$ = username
%$ = sitename
%$ = verification code
%$ = site link


标签: joomla