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

Delete unconfirmed users not working because firstaccess == 0

    XMLWordPrintable

Details

    • MOODLE_29_STABLE, MOODLE_30_STABLE, MOODLE_31_STABLE, MOODLE_33_STABLE
    • MOODLE_33_STABLE, MOODLE_34_STABLE
    • MDL-54106-master
    • Difficult
    • Hide
      1. Login as an admin.
      2. Enable self-registration by navigating to "Site administration / Plugins / Authentication / Manage authentication" and setting "Self registration" to "Email-based self-registration" under the "Common setttings" section
      3. Save the changes.
      4. Navigate to "Site administration / Server / Cleanup"
      5. Set "{{Delete not fully setup users after (deleteunconfirmed)" to one hour.
      6. Log out.
      7. Go to the login page.
      8. Under "Is this your first time here?", click "Create a new account"
      9. Enter the required information and create the new account.
      10. Repeat the process for another user.
      11. Login as admin
      12. Navigate to "Site administration / Users / Accounts / Browse list of users"
      13. Confirm only one of the self-registered users.
      14. Wait until the "deleteunconfirmed" period is over (1hr).
      15. After the wait period, run cron

        php admin/cli/cron.php

      16. Go back to "Site administration / Users / Accounts / Browse list of users"
        • CONFIRM that the unconfirmed user has been deleted and the confirmed user has not.
      Show
      Login as an admin. Enable self-registration by navigating to " Site administration / Plugins / Authentication / Manage authentication " and setting " Self registration " to " Email-based self-registration " under the " Common setttings " section Save the changes. Navigate to " Site administration / Server / Cleanup " Set "{{Delete not fully setup users after (deleteunconfirmed)" to one hour. Log out. Go to the login page. Under " Is this your first time here? ", click " Create a new account " Enter the required information and create the new account. Repeat the process for another user. Login as admin Navigate to " Site administration / Users / Accounts / Browse list of users " Confirm only one of the self-registered users. Wait until the " deleteunconfirmed " period is over (1hr). After the wait period, run cron php admin/cli/cron.php Go back to " Site administration / Users / Accounts / Browse list of users " CONFIRM that the unconfirmed user has been deleted and the confirmed user has not.

    Description

      Unconfirmed users aren't being deleted (or marked as deleted) by cron in our system.

      We have checked that new self enroled users that register via the signup form get user.firstaccess set to zero in database ($user->firstaccess = 0 in moodle/login/signup.php). Then, if they never confirm their account and don't access Moodle, it looks like that they cannot be deleted by moodle/lib/classes/task/delete_unconfirmed_users_task.php because the select query tests firstaccess > 0:

      "SELECT * FROM

      {user}

      WHERE confirmed = 0 AND firstaccess > 0 AND firstaccess < ? AND deleted = 0"

      Maybe we should use timecreated (set to time() at signup) instead of firstaccess in this query?

      Attachments

        Issue Links

          Activity

            People

              lucaboesch Luca Bösch
              carles Carles Bellver
              David Mudrák (@mudrd8mz) David Mudrák (@mudrd8mz)
              Damyon Wiese Damyon Wiese
              Rayna Mae Jayco Rayna Mae Jayco
              David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              16 Vote for this issue
              Watchers:
              21 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                15/Jan/18