Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: ethankcvds on December 06, 2010, 11:36:37 PM

Title: [4716] Remove Inactive Members bug.
Post by: ethankcvds on December 06, 2010, 11:36:37 PM
I've noticed over the past couple of days on my install of SMF 2.0 RC4 that Remove Inactive Members is removing people from the list that it should not be removing. For example some one registered today and I ran the the Remove Inactive Members with the activated their account after 30 days options it removes the act that just registered today from the list of members and those waiting for them to activate their account.

Similar to: http://www.simplemachines.org/community/index.php?topic=239823.msg1546396#msg1546396 (http://www.simplemachines.org/community/index.php?topic=239823.msg1546396#msg1546396)
Title: Re: Remove Inactive Members bug.
Post by: michau on January 04, 2011, 11:46:02 AM
I might have experienced similar problem, trying to reproduce it now - will post details as soon as I'm able to provide repetitive scenario.

In addition to that, I also run into out of memory problem when trying to run the clean up on around 14k members, where at least half should have been cleaned up. Cranking memory to 384MB directly in Subs-Members.php help for that.

Thx,
michau
Title: Re: Remove Inactive Members bug.
Post by: emanuele on May 06, 2011, 09:07:29 AM
If it helps, this can be solved by changing in ManageMaintenance.php
Code (search) Select
$where_vars = array(
'last_login' => $time_limit,
);
$where = 'mem.last_login < {int:last_login}';
if ($_POST['del_type'] == 'activated')
{
$where .= ' AND mem.is_activated = {int:is_activated}';
$where_vars['is_activated'] = 0;
}


Code (replace with) Select
$where_vars = array(
'last_login' => $time_limit,
'date_registered' => $time_limit,
);
if ($_POST['del_type'] == 'activated')
{
$where = 'mem.date_registered < {int:date_registered} AND mem.is_activated = {int:is_activated}';
$where_vars['is_activated'] = 0;
} else {
$where = 'mem.last_login < {int:last_login}';
}
Title: Re: Remove Inactive Members bug.
Post by: ethankcvds on May 08, 2011, 08:56:21 AM
Quote from: emanuele on May 06, 2011, 09:07:29 AM
If it helps, this can be solved by changing in ManageMembers.php
Code (search) Select
$where_vars = array(
'last_login' => $time_limit,
);
$where = 'mem.last_login < {int:last_login}';
if ($_POST['del_type'] == 'activated')
{
$where .= ' AND mem.is_activated = {int:is_activated}';
$where_vars['is_activated'] = 0;
}


Code (replace with) Select
$where_vars = array(
'last_login' => $time_limit,
'date_registered' => $time_limit,
);
if ($_POST['del_type'] == 'activated')
{
$where = 'mem.date_registered < {int:date_registered} AND mem.is_activated = {int:is_activated}';
$where_vars['is_activated'] = 0;
} else {
$where = 'mem.last_login < {int:last_login}';
}


Fix's this issue. Also do note that the code you need to replace is in ManageMaintenance.php not ManageMembers.php

ethankcvds
Title: Re: Remove Inactive Members bug.
Post by: emanuele on May 08, 2011, 11:50:04 AM
Quote from: ethankcvds on May 08, 2011, 08:56:21 AM
Also do note that the code you need to replace is in ManageMaintenance.php not ManageMembers.php
Right. :-[
I should stop doing two things at the same time, especially when the two files are named more or less the same... :P
Title: Re: Remove Inactive Members bug.
Post by: ethankcvds on May 11, 2011, 05:24:38 PM
An other thing is this fixed in the latest SVN version or is it still there? If not is it going to be tracked in the bug tracker and fixed for 2.0 final?
Title: Re: Remove Inactive Members bug.
Post by: Illori on May 11, 2011, 05:27:51 PM
this does not seem to be fixed in smf, i am not sure a bug report was created, and if it has been it should be added to the title of this thread.
Title: Re: Remove Inactive Members bug.
Post by: ethankcvds on May 11, 2011, 08:40:16 PM
Quote from: Illori on May 11, 2011, 05:27:51 PM
this does not seem to be fixed in smf, i am not sure a bug report was created, and if it has been it should be added to the title of this thread.

Just found it on the bug tracker http://dev.simplemachines.org/mantis/view.php?id=4716.
Title: Re: [4716] Remove Inactive Members bug.
Post by: live627 on May 28, 2011, 07:52:53 PM
This needs moved. The associated issue in Mantis is resolved.
Title: Re: [4716] Remove Inactive Members bug.
Post by: minky on July 26, 2012, 11:40:58 AM
I am running smf 2.0.2 when using 'Remove Inactive members' it also removes members who have a last_login = '0', this includes newish members who have not yet logged in.

It would be preferable if the option:

(1) did not delete accounts not yet activated (as there are options to deal with these elsewhere), or recently activated.

(2) Deleted those who had not logged in for > than the entered time span, those who with last_login == 0 && date_registered > time span

or perhaps

Activation results in a last_login of the date of activation.

Be very gratefull of a solution  :)



Title: Re: [4716] Remove Inactive Members bug.
Post by: emanuele on July 26, 2012, 12:12:27 PM
Yes, that's something that I find annoying (though I don't use pruning, so I forget rather quickly of it... :P).
In ManageMaintenance.php:

Code (find) Select
$where = 'mem.last_login < {int:time_limit}';

Code (replace with) Select
$where = 'mem.last_login < {int:time_limit} AND (mem.last_login != 0 OR mem.date_registered < {int:time_limit})';

That way it should not delete the member that didn't do their first login in the last xx (30) days.
Title: Re: [4716] Remove Inactive Members bug.
Post by: minky on July 27, 2012, 06:34:27 AM
Thank you emanuele, exactly what I needed, much appreciated.  8)