Home » Joomla

Add New Fields in Joomla Registration And Change Registration Mail Content

5 June 2010 One Comment

Posts and pages

Please visit below links to add custom fields to joomla registration page:

http://joomla-and-more.com/2010/02/05/how-to-velden-toevoegen-bij-de-joomla-registration-form/

http://www.mediainti.com/en/forum/6-tutorials/8-adding-additional-field-to-the-joomla-15-registration-form.html

To change content of registration mail :

To change conent of joomla registration mail follow the below steps:

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 register_save()

Below the line $username = $user->get(‘username’);

Add following line for city

$city = $user->get(‘city’);

5. Now in the same function ( function register_save())

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

One Comment »

  • emt training said:

    Great site. A lot of useful information here. I’m sending it to some friends!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.