To change content of registration mail
Follow the STEPS below:
Suppose we need to add ‘city’ field to the mail content
1. First goto components –> com_user —> controller.php
2. Findout function register_save()
Below the line $document =& JFactory::getDocument();
Add following line for city
$city = JRequest::getVar(‘city’);
3. Now in the same function ( function register_save() )
Below the line $user->set(‘gid’, $authorize->get_group_id( ”, $newUsertype, ‘ARO’ ));
Add following line for city
$user->set(‘city’, $city);
4. Now Findout function _sendMail(&$user, $password)
Below the line $username = $user->get(‘username’);
Add following line for city
$city = $user->get(‘city’);
5. Now in the same function ( function _sendMail(&$user, $password) )
Find out the foreach statement at the end of page there you need to change the code as
follows:
foreach ( $rows as $row )
{
if ($row->sendEmail)
{
$message2 = sprintf ( JText::_( ‘SEND_MSG_ADMIN’ ), $row->name, $sitename, $name, $email,
$username, $city);
$message2 .= “City:”.$city;
$message2 = html_entity_decode($message2, ENT_QUOTES);
JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
}
}
Please note the $city field in above code.
6. Now goto path language –> en-GB –> en-GB.com_user.ini
Here find out variable SEND_MSG_ADMIN ( nearly at line no. 117, this will only change content of mail going to admin )
Hello %s,\n\nA new user has registered at %s.\nThis e-mail contains their details:\n\nName: %s\nE-mail: %s\nUsername: %s\n\nCity: %s\n\nPlease do not respond to this message. It is automatically generated and is for information purposes only.
Please note the change in above code. Here we have added City: %s
Follow the STEPS below:
Suppose we need to add ‘city’ field to the mail content
1. First goto components –> com_user —> controller.php
2. Findout function register_save()
Below the line $document =& JFactory::getDocument();
Add following line for city
$city = JRequest::getVar(‘city’);
3. Now in the same function ( function register_save() )
Below the line $user->set(‘gid’, $authorize->get_group_id( ”, $newUsertype, ‘ARO’ ));
Add following line for city
$user->set(‘city’, $city);
4. Now Findout function _sendMail(&$user, $password)
Below the line $username = $user->get(‘username’);
Add following line for city
$city = $user->get(‘city’);
5. Now in the same function ( function _sendMail(&$user, $password) )
Find out the foreach statement at the end of page there you need to change the code as
follows:
foreach ( $rows as $row )
{
if ($row->sendEmail)
{
$message2 = sprintf ( JText::_( ‘SEND_MSG_ADMIN’ ), $row->name, $sitename, $name, $email,
$username, $city);
$message2 .= “City:”.$city;
$message2 = html_entity_decode($message2, ENT_QUOTES);
JUtility::sendMail($mailfrom, $fromname, $row->email, $subject2, $message2);
}
}
Please note the $city field in above code.
6. Now goto path language –> en-GB –> en-GB.com_user.ini
Here find out variable SEND_MSG_ADMIN ( nearly at line no. 117, this will only change content of mail going to admin )
Hello %s,\n\nA new user has registered at %s.\nThis e-mail contains their details:\n\nName: %s\nE-mail: %s\nUsername: %s\n\nCity: %s\n\nPlease do not respond to this message. It is automatically generated and is for information purposes only.
Please note the change in above code. Here we have added City: %s
No comments:
Post a Comment