You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
This plugin deletes records from the user tables if the user if it has not been confirmed for more than a certain time and is subscribed to a newsletter.
$query = "SELECT u.id FROM {user} u INNER JOIN {newsletter_subscriptions} ns ON u.id = ns.userid WHERE u.confirmed = 0 AND :now - u.timecreated > :limit"; $ids = $DB->get_fieldset_sql($query, array('now' => time(), 'limit' => $config->activation_timeout)); if (!empty($ids)) { list($insql, $params) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED); $DB->delete_records_select('user', "id " . $insql, $params);
I believe this should be pointed out.
Not everyone might want this to happen, plus the database might get dirty because
an unconfirmed user may have custom fields in the user_info_data table, populated during account creation
The text was updated successfully, but these errors were encountered:
Thank you for pointing that out. I do think, that only users are deleted who registered via the newsletter subscription for guest users. But if there are default values for custom user profile fields that might be written to that table. Moodle deletes unconfirmed users anyway so maybe that could just be removed from the code. What do you think @haunted2 ?
Moodle deletes unconfirmed users (only if the scheduled task \core\task\delete_unconfirmed_users_task is active and the cron.php is running), but it uses the global function delete_user() (lib/moodlelib.php) which deletes a lot of user related stuff but not the record in the user table.
As far as I know, Moodle never physically deletes that record, but does a logical deletion, changing username, email and password, just like when an administrator deletes a user using the "trash" icon from the users list.
Hello,
This plugin deletes records from the user tables if the user if it has not been confirmed for more than a certain time and is subscribed to a newsletter.
moodle-mod_newsletter/classes/task/send_newsletter.php
Line 69 in ed9cdee
$query = "SELECT u.id FROM {user} u INNER JOIN {newsletter_subscriptions} ns ON u.id = ns.userid WHERE u.confirmed = 0 AND :now - u.timecreated > :limit"; $ids = $DB->get_fieldset_sql($query, array('now' => time(), 'limit' => $config->activation_timeout)); if (!empty($ids)) { list($insql, $params) = $DB->get_in_or_equal($ids, SQL_PARAMS_NAMED); $DB->delete_records_select('user', "id " . $insql, $params);
I believe this should be pointed out.
Not everyone might want this to happen, plus the database might get dirty because
an unconfirmed user may have custom fields in the user_info_data table, populated during account creation
The text was updated successfully, but these errors were encountered: