Advertisement:

Author Topic: email Inactive Users  (Read 52125 times)

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,360
  • I don't really come from outer space
    • MissAllSunday on GitHub
    • SMF mods
Re: email Inactive Users
« Reply #220 on: February 05, 2018, 04:02:41 PM »
The log you sent is telling theres a duplicated function in the ScheduledTasks.php file but there isn't in the file you attached.

You need to attach the real file you are using or at least tell me if you did something else since you attached it.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline petewadey

  • Jr. Member
  • **
  • Posts: 138
Re: email Inactive Users
« Reply #221 on: February 05, 2018, 04:13:49 PM »
I realize there is a duplicate file, and I'm trying with the help of my host to remove all traces and install a fresh copy. If this fails, I will probably give up, as it's beyond my capability to sort this. Shame because I would really like to run this mod.
Anyway, I'll try one more time from scratch.
I will let you know how I get on.
Pete

Online aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: email Inactive Users
« Reply #222 on: February 05, 2018, 04:16:31 PM »
Hi, i'm still experiencing inconsistencies with this mod - it worked fine ages when my member base was smaller but now it's producing less emails.

what do you suggest is best to debug it without producing emails etc. ?

i don't really want to commit to queuing up real emails to send, i don't know if it is possible to just echo the candidate members name out somewhere, a temp table maybe ?

thoughts on getting it to do a "dry" run before the real one ?

The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,360
  • I don't really come from outer space
    • MissAllSunday on GitHub
    • SMF mods
Re: email Inactive Users
« Reply #223 on: February 06, 2018, 10:47:07 AM »
You can copy all the logic inside the scheduled task into a separate file, include all the files the scheduled task calls and replace the actual query to delete members with a var_dump() of the array that holds the ids or do a query with those ids to the memebrs table to get their names
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Online aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: email Inactive Users
« Reply #224 on: February 06, 2018, 04:10:55 PM »
excellent. i didn't know where to start but have used var_dump() to debug in the past.

it's on my "to do" list.

thanks Suki !
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline @rjen

  • Jr. Member
  • **
  • Posts: 286
  • Gender: Male
Re: email Inactive Users
« Reply #225 on: June 10, 2018, 12:21:52 PM »
I am considering to use this MOD.

There is one thing I cannot figure out though: I want to sent the reminders to all 'Regular members' , ie the ones that are NOT part of any membergroup.
Can that be done? And if so, how?

Thanks in advance...
Running SMF 2.0 with Tinyportal 1.6.0 at www.fjr-club.nl
Testing SMF 2.1 beta 4 with Tinyportal 1.6.1 at http://test2.fjr-club.nl/

Offline Suki

  • Kaizoku Jotei
  • Developer
  • SMF Super Hero
  • *
  • Posts: 15,360
  • I don't really come from outer space
    • MissAllSunday on GitHub
    • SMF mods
Re: email Inactive Users
« Reply #226 on: June 10, 2018, 03:40:18 PM »
No, you need to specifically select the user groups you want to target, the mod was designed like that from the beginning.
« Last Edit: June 10, 2018, 04:20:01 PM by Suki »
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Look at them. They're just asking for it. Maybe the human race deserves to be wiped out.

Offline @rjen

  • Jr. Member
  • **
  • Posts: 286
  • Gender: Male
Re: email Inactive Users
« Reply #227 on: June 10, 2018, 03:51:53 PM »
That’s too bad : I specifically want to to target the users NOT in a usergroup...

well actually in the group 'Regular Members'  which is not in the picklist of the mod...
« Last Edit: June 10, 2018, 04:23:22 PM by @rjen »
Running SMF 2.0 with Tinyportal 1.6.0 at www.fjr-club.nl
Testing SMF 2.1 beta 4 with Tinyportal 1.6.1 at http://test2.fjr-club.nl/

Online aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: email Inactive Users
« Reply #228 on: September 08, 2018, 11:50:00 AM »
FYI, I wrote a (suitable for VPS users) quick-and-dirty batch version of the emailer as it may handy and/or of interest to somebody:

Code: [Select]
<?php
$servername 
"localhost";
$username "?";
$password "?";
$dbname "?;
$tbpref = "?_";

// SET THESE TOO !
$days_not_logged_in = 365;
$do_email = 0;
// ---------

$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";

$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@site-name";
                                
$headers = "From$from_name <$from_email>";
                                
$body = "Dear $to_member, \n
We miss you 
as you have not logged in to https://site-name for over $difference days. \n
Your membership is safe however you may be deleted from the forum some time in the future if you remain inactive.
Of course you will be given ample warning should that be the case. \n
Come 
and visit us if you are bored :-) \n
Regards
, \n
Server Admin
";
                                
$subject = "Regarding your last login to site_name";
                                
$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();
?>

« Last Edit: September 08, 2018, 12:06:40 PM by aegersz »
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Online aegersz

  • SMF Hero
  • ******
  • Posts: 1,462
  • Gender: Male
  • "mods" junkie
    • dopetalk
Re: email Inactive Users
« Reply #229 on: September 08, 2018, 09:02:27 PM »
risky but seems to work for me (it just inspires condidence  :P)

batch php emailer/delete/report members who have NEVER logged in
The configuration of my Linux VPS (SMF 2.0 with 140+ mods) can be found here and notes on my mods can be found here (warning: those links will take you to a drug related forum)

Offline Sir Osis of Liver

  • SMF Hero
  • ******
  • Posts: 8,393
  • Riding the endless highway in the sky.
Re: email Inactive Users
« Reply #230 on: November 30, 2018, 11:11:46 AM »
Getting this error on messy forum -


http://www.forum.com/index.php?action=admin;area=eiu;sa=general2
2: in_array() expects parameter 2 to be array, boolean given
File: /home/forum/public_html/Themes/default/Admin.template.php
 Line: 909