How send user details in confirmed order email?

  • Posts: 224
  • Thank you received: 8
5 years 10 months ago #293218

Hello,
I'd like to send the user details (username and password) to the customers in their "confirmed order" email
I tried to copy this code from the user account email

<?php
$password = false;
if(HIKASHOP_J16){
	jimport('joomla.application.component.helper');
	$usersConfig = JComponentHelper::getParams( 'com_users' );
	if ($usersConfig->get('sendpassword')) {
		$password = true;
	}
}else{
	$password = true;
}
?>
<?php if($password)	echo JText::sprintf('YOU_CAN_LOG_IN_WITH');?><br/>
<?php echo JText::sprintf('HIKA_USERNAME').' : '.$data->username;?><br/>
<?php if($password)	echo JText::sprintf('HIKA_PASSWORD').' : '.$data->password.'<br/>'; ?>

but when I test it the username and password do not show; I only see
username:
password:
with no data

I tested this by creating a new order for myself, changing it to "confirmed" and sending a notification to myself, maybe this is not the right way to test this though...

Other questions:
1 - is it possible to show the user password in these emails? By testing the "user account" email the password is always hidden, should I put $password = true; ?

2 - I am already sending user details via Joomla default configuration, can I deactivate the "user account" email or is still necessary? (I am trying to avoid users to receive to many messages)

Thank you!

Last edit: 5 years 10 months ago by oloccina.

Please Log in or Create an account to join the conversation.

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
5 years 10 months ago #293259

Hi,

The username is in $data->cart->customer->username
However, you won't be able to give the password.
The password is encrypted when the user account is created. And it's impossible to decrypt.
So nowhere in your website do you have the unencrypted password.
When the user logs in, the password he provides is encrypted with the same algorithm and Joomla checks that this encrypted text corresponds to the encrypted text stored with the user account. So it's only possible to verify that a text corresponds to the password of the user account, and it's impossible to display the password of the user account.

It's only possible to get the password in the user details email because it is sent in the same process where the registration is being processed and thus the unencrypted password is still available in memory.

The following user(s) said Thank You: oloccina

Please Log in or Create an account to join the conversation.

Time to create page: 0.050 seconds
Powered by Kunena Forum