Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-46589

Automatic emails not sent after users import from CSV

    XMLWordPrintable

    Details

      Description

      After importing users from a CSV file, the whole process completes, but when the scheduled cron script tries to send emails to users it returns an error for this partial task:

      Notice: Undefined property: stdClass::$auth in xxx/lib/moodlelib.php on line 4731 
      Scheduled task failed: Send new user passwords,Authentication plugin {$a} not found. 
      

      We tested different versions and found:
      $release = '2.7+ (Build: 20140626)'; - still working
      $release = '2.7+ (Build: 20140703)'; - ends with error

      The problem is caused by a missing authentication value in the user object, which is required in file moodlelib.php by function update_internal_user_password() on line 4731

      $authplugin = get_auth_plugin($user->auth);
      

      Between versions two versions tested there are changes in the function setnew_password_and_mail() and the issue is related to this.

      As a hotfix of this issue we changed the function send_new_user_passwords_task function execute(), in the following line:

      $newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email,  
      

      ...to which we added the new attribute u.auth...

      $newusers = $DB->get_recordset_sql("SELECT u.id as id, u.email, u.auth, 
      

      It provides authentication method to following actions and fixes issue.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                6 Vote for this issue
                Watchers:
                16 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  8/Sep/14