Option to delete never logged in users
kilogauss - October 23, 2007 - 03:24
| Project: | Inactive User |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | patch (code needs work) |
Description
Attached is a version of 5.x-1.1 that gives the administrator the option to delete any user that has never logged in and the account is older than XX time. I did not add any of the options for email notification, etc.
| Attachment | Size |
|---|---|
| inactive_user.module_3.patch | 2.23 KB |

#1
What is the status on this? I really need this feature. When can we expect this to be tested and added to the official release code?
Thanks
#2
+ // automatically delete never logged in users+ if ($delete_time = variable_get('never_logged_in_user_auto_delete', 0)) {
+ $result = db_query('SELECT * FROM {users} WHERE access = 0 AND ((%d - created ) > %d) AND NOT (uid=1)', time(), $delete_time);
In the code above, the expression ((%d - created ) > %d) never gets TRUE and thus no user ever gets deleted. To test this, I replaced this expression with 0 and replaced the code that delete users by a line that blocks them. With my test mod, I could block all users that never loged in indeed.
So the problem lies in the value of $delete_time it seems. Hope this helps.
#3
Changing status based on marcbe's comment.
#4
Why the expression never gets TRUE?
I have tested this patch and it works fine for me, it is exactly doing what should hapen:
A = time() - created => timestamp from now until the user created the account so, 0 = really now, 3600 == hour ago, etc...
A > $time_deleted (time_deleted is 604800 for one week, 1209600 for 2 weeks etc...)
If time_deleted = 0 then the code will never execute because it's disabled.!
attached new version diff with the 1.4 release!