Thursday 18 December 2014

Modifying the System Email Notification email setting for New Registration on Joomla 3+

By default, the joomla send system email notifications to administrator when someone register from frontend. However,  if you are active joomla user and your account's "Receive System emails" is set to "Yes" under "Account Detail tab, then you would be getting email notification when someone register into the website. I am not sure whether it's a Joomla glitch or it has been setup like that.

However, if you need to only send email acknowledgement notification about new user registration to only those members who are active, have administrative privilege ('Administrator'), and who's "Receive System emails" status is set to "Yes, please follow the below step;

1. Go to the /root/components/com_users/models/registration.php,
2. Find the line number 519 on under the public function register($temp) function at line 339.
3. Please replace as below and it would work as mention above;


function register($temp)
{ 
 .....................
 .....................
 .....................
 // Get all admin users
 /*
 $query->clear()
  ->select($db->quoteName(array('name', 'email', 'sendEmail')))
  ->from($db->quoteName('#__users'))
  ->where($db->quoteName('sendEmail') . ' = ' . 1);
 */

 // Uncomment the above bit and add the below bit

 // Pulling all the Administrative privilege Users whos sendEmail/System emails is enabled.
 $query->clear()
  ->select($db->quoteName(array('gm.user_id', 'gm.group_id', 'g.title', 'u.id', 'u.name', 'u.email', 'u.sendEmail', 'u.block')))
  ->from($db->quoteName('#__user_usergroup_map').' AS gm')
  ->join('left', '#__usergroups AS g ON g.id=gm.group_id')
  ->join('left', '#__users AS u ON u.id=gm.user_id')
  ->where($db->quoteName('g.title') . ' = "Administrator" AND '. $db->quoteName('u.block') . ' = "0" AND ' . $db->quoteName('u.sendEmail') . ' = ' . 1);
 //echo nl2br(str_replace('#__','j3x_',$query));


 $db->setQuery($query);


 .....................
 .....................
 .....................
 .....................
 .....................

}

No comments:

Post a Comment

Please post any queries and comments here.