DELETE FROM usebb_members WHERE active = 0 AND last_login = 0
This will delete all member accounts which have never been used (0 logins).
Another option is the following, which deletes every inactive account which may have been used before but which hasn’t posted any posts yet:
DELETE FROM usebb_members WHERE active = 0 AND posts = 0
If you only want the previous queries to affect users registered more than x days ago, add the following to the end of your query:
AND regdate < UNIX_TIMESTAMP() - ( 60 * 60 * 24 * x )
Replace x with the number of days. Note this may not work on older MySQL versions.
As a final option, you can remove accounts last accessed more than x days ago without posts this way:
DELETE FROM usebb_members WHERE last_login < UNIX_TIMESTAMP() - ( 60 * 60 * 24 * x ) AND posts = 0
Again, replace x with a number of days, for example 87 (about 3 months).
Note you can’t easily remove user accounts which have been used for posting via SQL queries. To do this, you will have to wait for a UseBB version that supports this.
After you have deleted user accounts, you might want to adjust the user count to the actual number of users on your forum. Execute
SELECT COUNT(*) FROM usebb_members
and adjust the row holding the user count in usebb_stats with the result of the query.
_______________

