0

How can the username be sent to a user in the Joomla PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT?

The Joomla "forgot your password" process sends an email containing a token to the user. They can then use the url in the email to go to the "Confirm your account" page. But here they need to enter their username as well as the token. If the user has forgotten their password, they are unlikely to remember their username. So I'd like to display the username in the email to make it easy for users to reset their forgotten password.

The site uses Joomla 1.5.23.

Thanks.

Edited to add more info: I've seen this item about the same issue: Email Message configuration for forgot password

But that adds $fromname into the email; and that's the site name as shown in sent emails. It is not the username. So I don't believe that's the solution.

So I think I need a similar edit in components/com_user/models/reset.php to include the username in the email message in this line (about line 256):

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

Just adding $username (which is referred to earlier in the file) displays nothing.

And then I would amend the language to refer to the username variable in the following file:

language/en-GB/en-GB.com_user.ini
Community
  • 1
  • 1

2 Answers2

0

You are trying to add the user name in the forgot email? then you can try this.

you can find some line similar to this. in the reset model.

$user =& JFactory::getUser();

here the $user object the current requested user email(if exists).
The you will get all the details of that user by using this object.

like $user->username,$user->email etc.

This is not solving your problem,Then you should try a custom query to fetch the details of the user from jos_users using the requested email id(is unique).

Hope this will help..

Jobin
  • 8,238
  • 1
  • 33
  • 52
0

Firstly and I know this isn't part of your issue, but please upgrade to Joomla 1.5.26 which is the latest version of the 1.5 series.

Then try adding the following to the function:

$user =& JFactory::getUser();
$user2 = $user->username;

then change replace the $body variable with this:

$body = JText::sprintf('PASSWORD_RESET_CONFIRMATION_EMAIL_TEXT', $sitename, $user2, $token, $url);
Lodder
  • 19,758
  • 10
  • 59
  • 100
  • Thanks for this. I've edited components/com_user/models/reset.php following this approach and edited the text in language/en-GB/en-GB.com_user.ini. But the email to the user has blank space where the username should be. –  Nov 29 '12 at 09:16