I am creating a new user using this data:

$params = 'com_users';
$usersParams = JComponentHelper::getParams($params);
$new_user = JFactory::getUser(0);
$config = JComponentHelper::getParams('com_users');
$defaultUserGroup = $config->get('new_usertype', 2);
$jdata = array(
  "name" => $name,
  "username" => $email,
  "password" => $password,
  "password2" => $password,
  "email" => $email,
  "sendEmail" => 1,
  "groups" => array($defaultUserGroup)

$useractivation = $usersParams->get('useractivation');
if ($useractivation === 1) {
  $jdata['activation'] = JUtility::getHash(JUserHelper::genRandomPassword());
  $jdata['block'] = 1; // block the user
} else {
  $jdata['block'] = 0; // don't block the user

//Write to database
if (!$new_user->bind($jdata)) {
  throw new Exception("Could not bind data. Error: " . $new_user->getError());
  return false;
if (!$new_user->save()) {
  throw new Exception("Could not save user. Error: " . $new_user->getError());
  return false;

This works perfectly, but the new users are created with the "Receive System Emails" set to yes which means all new users are getting the admin emails. How can I disable this feature when creating a new user this way?


In $jdata array you are setting sendEmail to 1 which is activating the "Receive System Emails".

Just set sendEmail to 0 and you are done :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.