2

I'm using the User Class to create new users. Here are my fields :

$udata = array(
                "name"=>$data['name'],
                "username"=>$data['user'],
                "password"=>$data['pass'],
                "email"=>$data['email'],
                "block"=>0,
                "groups"=>array("1","2"),
                "params"=>array(
                    "admin_style" => "",
                    "admin_language" => "",
                    "language" => 'fr-FR',
                    "editor" => "",
                    "helpsite" => "",
                    "timezone" => ""

                ),
                "requireReset"=>1,
                "sendEmail"=>0,
            );

I put sendEmail to 0 but the email is still sent. Is there an other way to disable this function?

Thanks for your anwser !

1 Answer 1

2

The sendEmail property relates to whether or not the user should receive system emails, rather than whether or not a confirmation email should be sent upon user creation.

I had a quick look through the code and the confirmation email seems to be sent from the User - Joomla! plugin, in the onUserAfterSave function. There it checks the param mail_to_user before deciding whether to send or not.

This parameter is set within the options for the User - Joomla! plugin. Click on Plugins, and then on the User - Joomla! plugin and set Notification Mail to User to No

2
  • Thanks for your anwser. Unfortunatly, it doesn't work when I insert in params array. Is there a way to create plugin onUserAfterSave that will replace the original? If I create it, the original onUserAfterSave is still firing.
    – spiNOops
    Dec 18, 2020 at 13:10
  • Sorry, I should have tried it out. I've corrected the answer, and confirmed it works ok. Dec 18, 2020 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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