Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Due to erroneous handling of database access in lines 234-245 function inactive_user_cron(), users are never removed from table inactive_users.
These lines should be changed to:
// reset notifications if recent user activity
$users = db_query('SELECT uid FROM {inactive_users} WHERE uid <> 1'));
if ($users) {
while($uid = db_fetch_object($users)) {
$u = db_fetch_object(db_query('SELECT access, name FROM {users} WHERE uid = %d', $uid->uid));
if ($u->access > time() - 604800) {
// user activity in last week, remove from inactivity table
db_query('DELETE FROM {inactive_users} WHERE uid = %d', $uid->uid);
watchdog('user', t('recent user activity: %user removed from inactivity list', array('%user' => $u->name)), WATCHDOG_NOTICE, l(t('edit user'), "admin/user/edit/$uid->uid"));
}
}
}
The bugs are in all versions of this module.
Plus, in general, some of the database queries are substantially not efficient.
Comments
Comment #1
ekrispin CreditAttribution: ekrispin commentedSorry, there is one extra ")" in second line.
It should be:
Comment #2
deekayen CreditAttribution: deekayen commentedDon't you think it can be cut down a lot more than that? I haven't tried it, but I'm picturing something like:
Comment #3
deekayen CreditAttribution: deekayen commentedSupposedly closed by #661882: Updated test case and several fixes. Someone needs to verify.
Comment #4
deekayen CreditAttribution: deekayen commented#77835: Inactive_user does not delete users