Advertisement:

Author Topic: Enhancements to purge inactive members  (Read 74673 times)

Offline SMiFFER

  • Full Member
  • ***
  • Posts: 462
Re: Enhancements to purge inactive members
« Reply #120 on: September 11, 2018, 10:05:44 AM »
No, Nirose, you are wrong there. It does NOT do this well.

What it does is "send emails to inactive users and deletes them if they haven't logged in on the forum."
and that is clearly NOT what I requested. Would you please read my post above yours.

And you also gave reasons yourself in addition.
At least these 74 88 102 (getting more???)steps must be completed for SMF2.1 Final.
Last Full Version: 2.0 Final released almost 10 years ago on 20110604

QUOTE OF Aleksi "Lex" Kilpinen: "That version is old enough to go to school itself."

Offline aegersz

  • SMF Hero
  • ******
  • Posts: 1,692
  • Gender: Male
  • the "mods and tweaks" junkie
    • dopetalk (drugs and users)
Re: Enhancements to purge inactive members
« Reply #121 on: September 15, 2018, 03:14:48 AM »
I also had problems so i wrote two php batch scripts that will send emails.

Don't set the "do_delete" flag and if you upload it to your web root then you will, by default, get a listing of who hasn't logged in since "n" number of days and whose account has never been logged into.

It shows you their post count also.

last_online_emailer.php

Code: [Select]
<?php
// SET THESE FIRST !
$servername "localhost";
$username "dbuser";
$password "dbpass";
$dbname "smf209";
$tbpref "smf209_";
$domain "forum.site-name.org";
$days_not_logged_in 365 // only those who have not not logged for 365 days or more
$do_email 0 // enable to send emails

$connect = new mysqli($servername$username$password$dbname);
if (
$connect->connect_error) {
        die(
"Connection failed: " $connect->connect_error);
}
$sql "SELECT * FROM" " " $tbpref "members ORDER BY last_login";
//$sql = "SELECT * FROM" . " " . $tbpref . "members WHERE member_name = 'test' ORDER BY last_login";
$result $connect->query($sql);
if (
$result->num_rows 0) {
        while(
$row $result->fetch_assoc()) {
                if (!empty(
$row["last_login"])) {
                        
$dateSin =  $row["last_login"];
                        
$current_date date("U"/* to have it in microseconds */;
                        
$your_month date("m"$dateSin);
                        
$your_day =  date("d"$dateSin);
                        
$your_year =  date("Y"$dateSin);
                        
$selected_date_stamp mktime(0,0,0,$your_month,$your_day,$your_year);
                        
$selected_date date("U",$selected_date_stamp);
                        
$difference round (($current_date $selected_date)/(3600*24));
if ($difference >= $days_not_logged_in) {
echo $row["member_name"] . " " $row["email_address"] . " " "posts=" $row["posts"] . " ";
echo "Last logged in" " " $difference " " "days ago" PHP_EOL;
        $to_member =  $row["member_name"];
        $from_name "SMF Administrator";
                        
$from_email "smfadmin@" $domain;
                        
$headers "From: $from_name <$from_email>";
                        
$body "Dear $to_member, \n
We miss you as you have not logged in to https://
$domain for over $difference days. \n
Please come and visit us soon! \n
Regards, \n
Server Admin"
;
         $subject "Regarding your last login";
         $to_email $row["email_address"];
         if ($do_email) {
         if (mail($to_email$subject$body$headers)) {
                 echo "email sent" " ";
       } else {
         echo "email failed" " ";
       }

                        }
                }
}
} else {
        echo 
"0 results";
}
$connect->close();
?>

never_online_emailer.php

Code: [Select]
<?php
// SET THESE FIRST !
$servername "localhost";
$username "dbuser";
$password "dbpass";
$dbname "smf209";
$tbpref "smf209_";
$domain "forum.site-name.org";
$days_since_registered 30;
$do_email 0 // enable to send emails
$do_delete 0// enable to remove members forcefully (NOT ADVISABLE as "Forum > Maintenance > Routine" repairs are required afterwards)

$connect = new mysqli($servername$username$password$dbname);
if (
$connect->connect_error) {
        die(
"Connection failed: " $connect->connect_error);
}
$sql "SELECT * FROM" " " $tbpref "members WHERE last_login = '0'";
//$sql = "SELECT * FROM" . " " . $tbpref . "members WHERE member_name = 'testr'";
$result $connect->query($sql);
if (
$result->num_rows 0) {
        while(
$row $result->fetch_assoc()) {
                
$datereg $row["date_registered"];
                
$current_date date("U"/* to have it in microseconds */;
                
$your_month date("m"$datereg);
                
$your_day date("d"$datereg);
                
$your_year =  date("Y"$datereg);
                
$selected_date_stamp mktime(0,0,0,$your_month,$your_day,$your_year);
                
$selected_date date("U",$selected_date_stamp);
                
$difference round (($current_date $selected_date)/(3600*24));
                if (
$difference >= $days_since_registered) {
                        echo 
$row["member_name"] . " " $row["email_address"] . " " "registered" " " $difference " " "days ago" PHP_EOL;
                        
$to_member =  $row["member_name"];
                        
$from_name "SMF Administrator";
                        
$from_email "smfadmin@" $domain;
                        
$headers "From: $from_name <$from_email>";
                        
$body "Dear $to_member, \n
You have never logged in to https://
$domain since you joined us so I will be removing you soon unless you do so. \n
I have already activated your account but both that email and your activation mail probably went to your spam folder. \n
If you have any questions or need any help on this matter then just reply to me. \n
Regards, \n
Server Admin"
;
                        
$subject "Regarding your inactive membership";
                        
$to_email $row["email_address"];
                        if (
$do_email) {
                                if (
mail($to_email$subject$body$headers)) {
                                        echo 
"email sent" " ";
                                } else {
                                        echo 
"email failed" " ";
                                }
                        }
                        if (
$do_delete) {
                                
$sql2 "DELETE FROM" " " $tbpref "members WHERE member_name = '$to_member' ";
                                if (
$connect->query($sql2) === TRUE) {
                                        echo 
"$to_member deleted successfully";
                                } else {
                                        echo 
"Error deleting record: " $connect->error;
                                }
                        }
                }
        }
} else {
        echo 
"0 results";
}
$connect->close();
?>
« Last Edit: September 15, 2018, 03:27:11 AM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 150+ mods & some assorted manual tweaks) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum). My (House) music DJ dedication page is here

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #122 on: April 12, 2019, 12:09:43 PM »
New version:
Code: [Select]
1.3.8   2019-04-05
------------------
! SMF 2.1.x: Use HTML 5.
+ SMF compatibility: 2.1 RC1 to RC2.
! SMF 2.1.x: Languages: Only UTF-8 languages are used.

Offline ysu

  • Newbie
  • *
  • Posts: 8
Re: Enhancements to purge inactive members
« Reply #123 on: August 28, 2019, 11:08:48 PM »
Hey mate, I've tried and installed this mod, but I see no change in the user list after using it.  We've got a bunch of spammers registered that I wanted to clear out - they've got a lot of dormant accounts with no posts - but nothing seems to have happened.

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #124 on: August 29, 2019, 04:58:13 AM »
Hey mate, I've tried and installed this mod, but I see no change in the user list after using it.  We've got a bunch of spammers registered that I wanted to clear out - they've got a lot of dormant accounts with no posts - but nothing seems to have happened.
What is your SMF version?
How do you fill fields before click on Remove now button.

Notes:
My mod add some enhancements to "Remove Inactive Members" section, but this section is in SMF core.
My mod, and this section, is not for delete spammers, only remove members with certain conditions.

Offline ysu

  • Newbie
  • *
  • Posts: 8
Re: Enhancements to purge inactive members
« Reply #125 on: September 04, 2019, 12:35:38 AM »
Hey mate, I've tried and installed this mod, but I see no change in the user list after using it.  We've got a bunch of spammers registered that I wanted to clear out - they've got a lot of dormant accounts with no posts - but nothing seems to have happened.
What is your SMF version?
How do you fill fields before click on Remove now button.

Notes:
My mod add some enhancements to "Remove Inactive Members" section, but this section is in SMF core.
My mod, and this section, is not for delete spammers, only remove members with certain conditions.

SMF 2.0.15
I've filled the fields with "logical" criteria; users with 0 posts.
I've tried to play with the 1st option eg 'been registered more than 30 days' but to no avail.

Not that big a deal, we don't get that many spam regos, only 50 or so in backlog, I just thought it might be simpler to batch-rid of them.

Having said that I've tried it with trepidation; it maybe hard to double-check what has happened, afterwards.  This is really not my preferred function, just a 'next best' thing.   I really wish someone with time would create a mod to click the users in the user list and mass-ban them; that'd be a far nicer solution.   Funnily enough, even though spammers seem to be a common problem, nobody though of doing it, sadly.

Anyway, don't bother yourself with it, I'll just get through them manually.

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #126 on: September 05, 2019, 01:41:41 PM »
Hey mate, I've tried and installed this mod, but I see no change in the user list after using it.  We've got a bunch of spammers registered that I wanted to clear out - they've got a lot of dormant accounts with no posts - but nothing seems to have happened.
What is your SMF version?
How do you fill fields before click on Remove now button.

Notes:
My mod add some enhancements to "Remove Inactive Members" section, but this section is in SMF core.
My mod, and this section, is not for delete spammers, only remove members with certain conditions.

SMF 2.0.15
I've filled the fields with "logical" criteria; users with 0 posts.
I've tried to play with the 1st option eg 'been registered more than 30 days' but to no avail.

Not that big a deal, we don't get that many spam regos, only 50 or so in backlog, I just thought it might be simpler to batch-rid of them.

Having said that I've tried it with trepidation; it maybe hard to double-check what has happened, afterwards.  This is really not my preferred function, just a 'next best' thing.   I really wish someone with time would create a mod to click the users in the user list and mass-ban them; that'd be a far nicer solution.   Funnily enough, even though spammers seem to be a common problem, nobody though of doing it, sadly.

Anyway, don't bother yourself with it, I'll just get through them manually.

Did you test these mods?
StopSpammer, https://custom.simplemachines.org/mods/index.php?mod=1547
httpBL, https://custom.simplemachines.org/mods/index.php?mod=2155

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #127 on: March 05, 2020, 10:09:19 AM »
Compatible with SMF 2.0.16 and 2.0.17.

Offline Belgarathh

  • Newbie
  • *
  • Posts: 2
Re: Enhancements to purge inactive members
« Reply #128 on: May 02, 2020, 12:27:19 PM »
Hi davidhs

Using this mod, could I set up the following:

I want to delete members with zero posts who have not logged in for 365 days (both conditions must be met)

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #129 on: May 02, 2020, 01:22:23 PM »
I want to delete members with zero posts who have not logged in for 365 days (both conditions must be met)
You can do this:
Quote
Remove all members who have not logged in for 365 days.
Remove members who have 0 posts or less (empty = any number)
...
(all conditions must be true)

Offline Belgarathh

  • Newbie
  • *
  • Posts: 2
Re: Enhancements to purge inactive members
« Reply #130 on: May 02, 2020, 06:13:54 PM »
I want to delete members with zero posts who have not logged in for 365 days (both conditions must be met)
You can do this:
Quote
Remove all members who have not logged in for 365 days.
Remove members who have 0 posts or less (empty = any number)
...
(all conditions must be true)

Perfect.  THANK YOU

Offline Bugo

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 1,662
  • Gender: Male
    • dragomano on GitHub
    • Support me on Ko-fi
Re: Enhancements to purge inactive members
« Reply #131 on: June 27, 2020, 04:41:59 AM »
Updated the Russian translation

Offline davidhs

  • Sophist Member
  • *****
  • Posts: 1,134
  • Gender: Male
Re: Enhancements to purge inactive members
« Reply #132 on: June 27, 2020, 07:21:09 AM »
Updated the Russian translation
Thank you! I add in next update.

Offline SMiFFER

  • Full Member
  • ***
  • Posts: 462
Re: Enhancements to purge inactive members
« Reply #133 on: August 22, 2020, 03:22:22 AM »
Please add the following options: Remove all members who have ...... 

- not logged in (for x days) (a)
- not made any post (for x days) (b)

That data is easily visible on
a) Summary Page
b) Show Posts Page

And send those users a "good-bye for inactivity" message

Please do not alter the title of a reply in a mod support topic.  Title reverted - Iris.
« Last Edit: August 22, 2020, 05:42:16 AM by Irisado »
At least these 74 88 102 (getting more???)steps must be completed for SMF2.1 Final.
Last Full Version: 2.0 Final released almost 10 years ago on 20110604

QUOTE OF Aleksi "Lex" Kilpinen: "That version is old enough to go to school itself."

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,350
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Enhancements to purge inactive members
« Reply #134 on: August 22, 2020, 10:36:08 AM »
Please add the following options: Remove all members who have ...... 

- not logged in (for x days) (a)
- not made any post (for x days) (b)

That data is easily visible on
a) Summary Page
b) Show Posts Page

And send those users a "good-bye for inactivity" message

Please do not alter the title of a reply in a mod support topic.  Title reverted - Iris.

it would be nice to be added, however there is a mod that will email and/or delete inactive users > https://custom.simplemachines.org/mods/?mod=3849

Offline SMiFFER

  • Full Member
  • ***
  • Posts: 462
Re: Enhancements to purge inactive members
« Reply #135 on: September 14, 2020, 01:12:19 PM »
*sigh*It is like you are being deliberately dense or do not WANT to understand me.
I asked for
> - not made any post (for x days)
which is clearly neither part of the other mod. I wrote this to you before and already there you ignored it.
Are you doing this intentionally or have I overread something?
At least these 74 88 102 (getting more???)steps must be completed for SMF2.1 Final.
Last Full Version: 2.0 Final released almost 10 years ago on 20110604

QUOTE OF Aleksi "Lex" Kilpinen: "That version is old enough to go to school itself."

Offline shadav

  • Support Specialist
  • Sophist Member
  • *
  • Posts: 1,350
  • Gender: Female
    • shadav on Facebook
    • leashadav on GitHub
    • Ask The Muslims: A Place To Ask Honest Questions and Receive Respectful Answers
Re: Enhancements to purge inactive members
« Reply #136 on: September 20, 2020, 10:12:59 PM »
*sigh*It is like you are being deliberately dense or do not WANT to understand me.
I asked for
> - not made any post (for x days)
which is clearly neither part of the other mod. I wrote this to you before and already there you ignored it.
Are you doing this intentionally or have I overread something?

well excuse me for trying to help but you did also ask for

- not logged in (for x days) (a)
which is what the mod that I tried to show you does....but hey if you don't want to use it, that's up to you....no need to be rude

and I have no idea what you are even talking about
I wrote this to you before and already there you ignored it.
Are you doing this intentionally or have I overread something?

Offline shawnb61

  • Developer
  • SMF Hero
  • *
  • Posts: 3,139
    • sbulen on GitHub
Re: Enhancements to purge inactive members
« Reply #137 on: September 20, 2020, 10:25:04 PM »
Thanks for pitching in, shadav, it's appreciated. :)  By most. ::)
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp


Offline SMiFFER

  • Full Member
  • ***
  • Posts: 462
Re: Enhancements to purge inactive members
« Reply #139 on: September 30, 2020, 05:48:11 AM »
Once again, YOU * ARE * WRONG!

You solve only 50% of the problem - and prove that you deliberately ignore the other half.
I know what I asked, I asked:

- not made any post (for x days) (b)

The mod you mention does * NOT * do that.

Thanks
At least these 74 88 102 (getting more???)steps must be completed for SMF2.1 Final.
Last Full Version: 2.0 Final released almost 10 years ago on 20110604

QUOTE OF Aleksi "Lex" Kilpinen: "That version is old enough to go to school itself."