***CORRECTED***Hi,
Again, as in
this post, you'll need to use this as one-time procedure through your theme functions.php.
Of course
first do a full backup of your database, just in case. I think it would be a good idea to do this at midnight or so, because likely it'll eat up all your resources if we're talking about hundreds of users involved.
Add this at the very bottom of your theme functions.php (take care not to leave blank lines after this):
<?php
function cust_delete_inactive_users() {
$inactive_users = User::newInstance()->search(0, 50000, 'pk_i_id', 'ASC', array("dt_access_date < '2015-01-01'" => '', 'i_items' => 0 ));
foreach ($inactive_users['users'] as $user) {
User::newInstance()->deleteUser($user['pk_i_id']);
}
echo "Done, " . $inactive_users['rows'] . " inactive users where deleted from the database";
}
osc_add_hook('admin_content_footer', 'cust_delete_inactive_users');
?>
Change the date here (2015-01-01, year-month-day), all users that never have posted and haven't logged in after that date will be deleted.Enter your Admin Dashboard and the process will start. Probably you'll get a timeout at first, wait a few minutes and do it again, repeat until no timeout and you may see this message in the footer (Below Osclass version):
Done, X inactive users where deleted from the database
Of course, if there were previous timeouts, you won't see the real number of deleted users, but the few last. If you want to know the exact amount compare the number before and after the procedure in your Users page.
Careful with all the steps, if something goes wrong restore your DB. At the end, delete the code from your functions.php (it wouldn't do harm, but unnecesary now).
Regards