Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: Suki on April 19, 2014, 02:00:47 PM

Title: email Inactive Users
Post by: Suki on April 19, 2014, 02:00:47 PM
Link to the mod (https://custom.simplemachines.org/index.php?mod=3849)

emailInactiveUsers
===================

##### Sends emails to inactive users and deletes them if they haven't logged in on the forum.

##### Some features:

- Chose how many days the user needs to be inactive for the mod to send the mail.
- Chose how many days since the mail was sent for the user to be deleted.
 -Prevent users from been deleted after seding them an email.
- Customize the mail body and subject, you can use the following wildcards:
   - {user_name}' => user's real name,
   - {display_name}' => user's display name,
   - {last_login}' => user's last time s(he) logged in on the forum,
   - {forum_name}' the forum's name,
   - {forum_url}' => the forum's url,
- Check which usergroups will be affected by this mod. Main admin group cannot be affected.
- Once the user has received the email and the grace period has expired, (s)he will appear on the mod's user list, on that list you can:
   - Mark the user for deletion. The user will be deleted the next time the scheduled task gets executed, there is a small chance for the user to skip deletion if (s)he logs in between the time the admin marked their account for deletion and the time the scheduled task gets executed, this timeframe, however, could be very small and it cannot be larger than a full day.
   - Mark the user as "untouchable" This special setting tells the mod to completely ignore this account, that is, the account won't be eligible for deletion even if it complies with all of the criteria.
- A sub-menu in the admin button in the main menu will be added if the mod found 1 or more people ready to be marked for deletion.

##### Needs PHP 5.3 or greater, SMF 2.0 or greater.

##### License
This mod is license under the [MPL 2.0 license](http://www.mozilla.org/MPL/2.0/).

##### Note
Special thanks to [Kolya ](http://www.simplemachines.org/community/index.php?action=profile;u=8490) for allowing this mod to be open source and free for everyone. the forum
Title: Re: email Inactive Users
Post by: Shambles on April 19, 2014, 03:08:04 PM
I'll have a look at this, thanks for the good work :)
Title: Re: email Inactive Users
Post by: Shambles on April 19, 2014, 03:50:32 PM
If I could make one suggestion, it's that the Scheduled Task "emailInactiveUsers" should be disabled by default, until such time that the feature itself is enabled (which it isn't, by default).

Incredibly feature-rich coding, I have to say :D
Title: Re: email Inactive Users
Post by: radu81 on April 19, 2014, 07:50:51 PM
thank you Suki for this mod!
Title: Re: email Inactive Users
Post by: iorkara on April 20, 2014, 03:42:54 AM
Am I able to have an option that does not delete users at all? I just want to email inactive users, not delete them after some period...
Title: Re: email Inactive Users
Post by: Shambles on April 20, 2014, 06:59:33 AM
Couple of errors being logged (not a big issue)

Title: Re: email Inactive Users
Post by: Suki on April 20, 2014, 08:45:09 AM
Quote from: iorkara on April 20, 2014, 03:42:54 AM
Am I able to have an option that does not delete users at all? I just want to email inactive users, not delete them after some period...

Not at the moment, but shouldn't be difficult to add an admin setting and then apply that check just before the mod collects the users who meet the criteria for been deleted.


@Shambles, yes, I'm aware of that, the first one is a nasty bug with the multiple select, if you don't select any group, the setting is saved as false but the template requires it to be an empty array, not  boolean false. It only happens if you left that setting completely empty.

The other one is a missing "  on    $config_vars[] = array('large_text', 'eiu_message', '6" style="width:95%', 'subtext' => $txt['eiu_message_sub']);
  right after the style="width:95%, should be style="width:95%"
Title: Re: email Inactive Users
Post by: Shambles on April 20, 2014, 09:26:18 AM
Thanks.

The fix you supplied for issue #2 doesn't cure the problem (error message persists) :(

Should that 6" be in there?
Title: Re: email Inactive Users
Post by: Suki on April 20, 2014, 09:41:13 AM
Its just a hardcoded thing for some browsers, you can remove it if you want to.
Title: Re: email Inactive Users
Post by: Impsat-1 on April 21, 2014, 02:01:30 AM
Mmm... hey Great Job, but anyone can translate to spanish_latin-utf8 ???... will be great, Thanks & Regards.... 8).-
Title: Re: email Inactive Users
Post by: Suki on April 21, 2014, 07:59:00 AM
I don't have any Spanish forum anymore so I just didn't do any translation.
Title: Re: email Inactive Users
Post by: demlak on April 24, 2014, 07:59:57 PM
Quote from: iorkara on April 20, 2014, 03:42:54 AM
Am I able to have an option that does not delete users at all? I just want to email inactive users, not delete them after some period...

is there any solution on that? i was thinking about setting deletion days to 10.000 or so.. as a workaround..?
Title: Re: email Inactive Users
Post by: Suki on April 24, 2014, 09:07:15 PM
Sure, will add a setting in the next version.
Title: Re: email Inactive Users
Post by: iorkara on April 24, 2014, 11:43:50 PM
Quote from: Suki on April 24, 2014, 09:07:15 PM
Sure, will add a setting in the next version.

Ok great! Looking forward to this. Thank you.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on April 25, 2014, 01:09:13 AM
Quote from: demlak on April 24, 2014, 07:59:57 PM
Quote from: iorkara on April 20, 2014, 03:42:54 AM
Am I able to have an option that does not delete users at all? I just want to email inactive users, not delete them after some period...

is there any solution on that? i was thinking about setting deletion days to 10.000 or so.. as a workaround..?
That's the first thing i thought. Put like 1000000000000000000000 days before account deletion and you will be done XD they will die sooner  ;D ::) :P
And thanks for the great mod :D
Title: Re: email Inactive Users
Post by: MotRude on April 25, 2014, 09:23:12 AM
Thank you for this mod...Great Work!
Title: Re: email Inactive Users
Post by: Xarkurai on April 25, 2014, 10:14:47 AM
Much appreciated mod and work, thanks for sharing :).
Title: Re: email Inactive Users
Post by: SaltedWeb on April 29, 2014, 11:32:02 AM
I like this idea but will wait until the version that does not automatically delete members.

Thank you.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on April 29, 2014, 01:21:06 PM
Discovered a little annoying thing, everytime i uninstall a mod it gives me an error telling me the thing i am attaching.
It's kinda of annoying but nothing happens actually and that line does not even exist in that file!!!!!!! Wtf????  :o
Title: Re: email Inactive Users
Post by: Suki on April 29, 2014, 05:00:35 PM
You need to disable he evaluation of templates from your admin panel

admin / configuration / server settings

clean your error log and wait untl that error happens again, you will now see the real file where the error is.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on April 29, 2014, 05:44:56 PM
Quote from: Suki on April 29, 2014, 05:00:35 PM
You need to disable he evaluation of templates from your admin panel

admin / configuration / server settings

clean your error log and wait untl that error happens again, you will now see the real file where the error is.
Thanks for your reply man
I did what you said and produced the error because i had noticed that it occurs always and only when i try to uninstall a mod. (i uninstalled the tynipic one to produce the error because it's very easy to re-install  ;) )
The error is the one attached and the line is this one:
<br /><a href="', $scripturl, '?action=admin;area=packages;sa=remove;package=', $_REQUEST['package'], ';', $context['session_var'], '=', $context['session_id'], '"', $package['is_installed'] && $package['is_current'] ? ' onclick="return confirm(\'' . $txt['package_delete_bad'] . '\');"' : '', '><strong>[ ', $txt['click'], $txt['package_delete'], $txt['mod'], ' ]</strong></a>';
Could you help me to fix this please? I would appreciate it very much...
Title: Re: email Inactive Users
Post by: Suki on April 29, 2014, 06:04:55 PM
its not an error related to this mod, I suggest you to open a new support topic with your Package.template and sources/Packages.php as attachments.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on April 29, 2014, 06:19:42 PM
I might disagree because it started to happen when i installed this mod and the error it was giving me before disabling the evaluation panel was pointing to Emailinactiveusers T.T :'( and sorry the attachment is a bit wrong i'll redo it. It happens everytime i try to uninstall something and like i said it started to happen when i installed this mod so no doubt it's something about it, or at least something not fully compatible with something else in the code :'(
Title: Re: email Inactive Users
Post by: Suki on April 29, 2014, 06:28:26 PM
It points out to this mod because its the only mod you have that uses hooks, the language file this mod uses is the last file loaded by SMF before evaluating, thats the only reason this mod appears on your error log, otherwise it has nothing to do with your error.

Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on April 29, 2014, 06:38:02 PM
How can you know that it's my only mod using hooks? :O just because i had evaluation off it doesn't mean i can0t have installed a mod using hooks :O meantime i will post it in the support board as you said but i don't get how you could state what you said...
Title: Re: email Inactive Users
Post by: Suki on April 29, 2014, 06:43:52 PM
Its either your only mod using hooks or the latest (that uses hooks) one installed.  Doesn't make any difference, the point here is that this mod is the latest one been loaded by your installation and the language file is the last loaded file.

Basically its just a coincidence.
Title: Re: email Inactive Users
Post by: zarachrome on May 03, 2014, 04:31:09 PM
Hi, Suki;

I've installed the mod in a spanish forum and it seems to work properly, except for erasing inactive users.
I've tried with the users that have not entered the forum in a year or more, with 3000 messages or less and when the time I´ve specified ends, the mod does nothing. It doesn't show the list of users to be deleted and, of course, it does not delete them.
Aldo, I've tried with any other settings and it doesn't work.
My forum is http://fotograncanaria.org

I would appreciate ant help.
Thank you for the mod and for your support  :)
Title: Re: email Inactive Users
Post by: Suki on May 04, 2014, 08:24:18 AM
Enter you DB with phpmyadmin of similar, go to the members table and pick a member that it should have been marked for deletion, post here the values for  columns:  to_delete, inactive_mail and sent_mail

Keep in minf tht only those members whos account is active will be taken into consideration, you also need to specify at least one membergroup and the users nees to belong to that group
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on May 04, 2014, 06:51:10 PM
Quote from: Suki on April 29, 2014, 06:43:52 PM
Its either your only mod using hooks or the latest (that uses hooks) one installed.  Doesn't make any difference, the point here is that this mod is the latest one been loaded by your installation and the language file is the last loaded file.

Basically its just a coincidence.
Dang it sorry man you had been so quick that i hadn't even seen that! Anyway yes thanks fot the help it's an issue related to another mod, THIS ONE. (http://custom.simplemachines.org/mods/index.php?mod=2670) Sorry for the no answer in the first place, i think i seemed a bit rude for that, thank you again and sorry for the inconvenience.
Title: Re: email Inactive Users
Post by: Suki on May 11, 2014, 07:52:36 PM
OK, got the new version but before I update the main page I would like someone to give it a try first and see if there is no errors.

mini changelog:

- Added a setting to only mail members instead of mail and remove them.
- Added Spanish_la/utf8 translation
- removed some duplicated language strings
Title: Re: email Inactive Users
Post by: demlak on May 13, 2014, 09:29:39 PM
i Just gave it a try.. is it standard, that "generel settings" and "user list" do show the same settings page "Email Inactive Users"?

i don´t see anything different on "user list"


p.s.
in the description text, there is a typo.. you wrote "not after the main was sent".. i think this should be "mail" not "main"..

p.p.s. error log says (german):
http://board.url/index.php?action=admin;area=eiu
Filter hinzufügen: Nur Fehlermeldungen mit der gleichen Nachricht anzeigen
2: in_array() expects parameter 2 to be array, boolean given
Filter hinzufügen: Nur Fehler von dieser Datei zeigen
Datei: /boardfolder/Themes/default/languages/emailInactiveUsers.english.php (show_settings sub template - eval?)
Zeile: 903
Title: Re: email Inactive Users
Post by: demlak on May 19, 2014, 03:33:29 PM
*knock*knock*
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on May 19, 2014, 06:25:44 PM
Quote from: demlak on May 13, 2014, 09:29:39 PM
i Just gave it a try.. is it standard, that "generel settings" and "user list" do show the same settings page "Email Inactive Users"?

i don´t see anything different on "user list"


p.s.
in the description text, there is a typo.. you wrote "not after the main was sent".. i think this should be "mail" not "main"..

p.p.s. error log says (german):
http://board.url/index.php?action=admin;area=eiu
Filter hinzufügen: Nur Fehlermeldungen mit der gleichen Nachricht anzeigen
2: in_array() expects parameter 2 to be array, boolean given
Filter hinzufügen: Nur Fehler von dieser Datei zeigen
Datei: /boardfolder/Themes/default/languages/emailInactiveUsers.english.php (show_settings sub template - eval?)
Zeile: 903

Man how in the world can you expect a free mod creator to help you if you ask things like that?

Please fix those and think that if you act like "yeah i tried your stuff on which you you worked for hours but nah i don't like it and all i care about is that error it gave me etc..." it can make people very angry and not willing to help at all, i wouldn't blame him.
Hope you not mad at me for this message, this was just a reminder because probably you didn't even realize until now what i told you ;) let us know
Title: Re: email Inactive Users
Post by: Shambles on May 20, 2014, 01:10:26 PM
Tough room  :o
Title: Re: email Inactive Users
Post by: Arantor on May 20, 2014, 01:49:06 PM
I'd say that it's all about just trying to encourage a better mindset for everyone.
Title: Re: email Inactive Users
Post by: mikk on May 21, 2014, 02:56:58 PM
Quote from: Suki on May 11, 2014, 07:52:36 PM
OK, got the new version but before I update the main page I would like someone to give it a try first and see if there is no errors.

Hi!

Thanks for this mod! I try this version (v1.1).

First look:
- Settings/ General settings and User List page is same, I don't see any differents.
- After I'm uninstalling, the spanish languge files is remain on the server.

My question: I want test this mod, how can I set any user to simulate his inactivity?
I think I try this with phpMyAdmin but what can I change?
Example: I'm wanting to set, the test user (name is: test) is inactive 30 days ago. After I'm running this mod scheluded task, and I want see what's happening.

Thanks!

sorry my poor English.
Title: Re: email Inactive Users
Post by: zarachrome on May 23, 2014, 03:52:47 AM
Quote from: Suki on May 04, 2014, 08:24:18 AM
Enter you DB with phpmyadmin of similar, go to the members table and pick a member that it should have been marked for deletion, post here the values for  columns:  to_delete, inactive_mail and sent_mail

Keep in minf tht only those members whos account is active will be taken into consideration, you also need to specify at least one membergroup and the users nees to belong to that group

Hi, Suki;

I'm sorry; I've been too busy.
What I've got in tables:
to_delete: 1
inactive_mail: 1401148629
sent_mail: 1400543829

But in the user list, in mod's settings, I see the message "There aren't any users marked for potential deletion".

Still with version 1.0.

Thank you for your help.
Title: Re: email Inactive Users
Post by: Suki on May 23, 2014, 11:21:43 AM
yeah, I somehow end up uploading a branch I was working on but decided it wasn't worth the effort. will take a look at it when I have some time and upload the correct branch.
Title: Re: email Inactive Users
Post by: zarachrome on May 25, 2014, 04:12:42 AM
Quote from: Suki on May 23, 2014, 11:21:43 AM
yeah, I somehow end up uploading a branch I was working on but decided it wasn't worth the effort. will take a look at it when I have some time and upload the correct branch.

OK, thank you very much.
Title: Re: email Inactive Users
Post by: zarachrome on May 29, 2014, 04:42:55 PM
Quote from: Suki on May 23, 2014, 11:21:43 AM
yeah, I somehow end up uploading a branch I was working on but decided it wasn't worth the effort. will take a look at it when I have some time and upload the correct branch.

Sorry, Suki,

The mod works pretty well, but I thought it makes the user list when the date is on, but in fact the list is made when the days you specify + the date the mod is programmed arrive.
For example:
I program it to delete users when they are 365 days out of the forum, and the I give them 7 days to enter or not.
So, the user list to be deleted appears when 365 + 7 = 372 days have passed, not before.

Sorry for my (poor) english and thank you again for this excellent mod  ;)
Title: Re: email Inactive Users
Post by: Suki on May 30, 2014, 12:55:47 PM
Yeah, it is somehow complicated, I know I did changed the behavior a couple of times but since I haven't checked the code recently I have no idea whats the current state and behavior.

In theory it should be like this:

the mod checks your database everyday looking for new inactive users, this is done by getting the current day minus the days you specified for the users to be inactive, in your case is 365 so:

$inactiveFor = 86400 * (!empty($modSettings['eiu_inactiveFor']) ? $modSettings['eiu_inactiveFor'] : 15);

There is also a "grace period"

$sinceMail = 86400 * (!empty($modSettings['eiu_sinceMail']) ? $modSettings['eiu_sinceMail'] : 15);

The list does indeed show only the users who already passed the first checks and the grace period and are still inactive,  the list doesn't show the potential inactive users but  the users who are ready to be confirmed for deletion by the admin, meaning the users who were marked as inactive AND also their grace period has expired.

Title: Re: email Inactive Users
Post by: zarachrome on May 30, 2014, 01:40:10 PM
That's right!
Thank you for explain it  :)
Title: Re: email Inactive Users
Post by: Suki on June 10, 2014, 03:10:44 PM
Quote from: demlak on May 13, 2014, 09:29:39 PM
i Just gave it a try.. is it standard, that "generel settings" and "user list" do show the same settings page "Email Inactive Users"?

i don´t see anything different on "user list"


p.s.
in the description text, there is a typo.. you wrote "not after the main was sent".. i think this should be "mail" not "main"..

p.p.s. error log says (german):
http://board.url/index.php?action=admin;area=eiu
Filter hinzufügen: Nur Fehlermeldungen mit der gleichen Nachricht anzeigen
2: in_array() expects parameter 2 to be array, boolean given
Filter hinzufügen: Nur Fehler von dieser Datei zeigen
Datei: /boardfolder/Themes/default/languages/emailInactiveUsers.english.php (show_settings sub template - eval?)
Zeile: 903



OK, I uploaded the correct package.

The "in_array() expects parameter 2 to be array, boolean given" error is an SMF bug when using a multiple select box, it only happens the first time you install the mod, by default SMF sets an non existent setting as a boolean false but the code to show the multiple select HTML code needs an array, in this case, an empty array.  I vaguely remember I fixed that on 2.1 but I don't know if I ever pushed the fix or not, will take a look at it when I get back.

Anyway, heres the correct branch, if you enable the "Disable the deletion of users feature" option then the user list will always remain empty since the change I introduced will reset the user status back to normal instead of mark the user for deletion.
Title: Re: email Inactive Users
Post by: mikk on June 13, 2014, 11:01:15 AM
Quote from: Suki on June 10, 2014, 03:10:44 PMOK, I uploaded the correct package.

Hi!

Thanks for this mod,  I'm testing this.

Problems:
- With non-UTF8 language forum, non-ASCII2 chars is lost in subject and in the mail body. But with UTF8 forum all character is OK.
- html code doesn't work in mail body,  example:<b>
- after mod uninstall, "inactive_mail", "sent_mail", and "to_delete" is remain in the database
- after mod uninstall, this mod scheduled task didn't delete.
Title: Re: email Inactive Users
Post by: Suki on June 13, 2014, 11:20:08 AM
Quote
- With non-UTF8 language forum, non-ASCII2 chars is lost in subject and in the mail body. But with UTF8 forum all character is OK.

Could you give me an example. not so sure if theres something I can actually do about it.

Quote
- html code doesn't work in mail body,  example:<b>
This is intentional. sendmail does have a setting for allowing HTML on the body, if you want to use HTML change it on the mod's code:


// Send the mail away!
foreach($messages as $m)
sendmail($m['mail'], $m['subject'], $m['message'], null, null, false);


Quote
- after mod uninstall, "inactive_mail", "sent_mail", and "to_delete" is remain in the database
- after mod uninstall, this mod scheduled task didn't delete.

If you want to remove those settings you need to check the "Remove all data associated with this modification"  checkbox when uninstalling.
Title: Re: email Inactive Users
Post by: Arantor on June 13, 2014, 11:25:36 AM
The scheduled task remover probably should be put into a <code> block rather than a <database> block in the uninstaller so it will always be run regardless.
Title: Re: email Inactive Users
Post by: mikk on June 13, 2014, 11:48:07 AM
Hi!

Quote
- With non-UTF8 language forum, non-ASCII2 chars is lost in subject and in the mail body. But with UTF8 forum all character is OK.

Quote from: Suki on June 13, 2014, 11:20:08 AM
Could you give me an example. not so sure if theres something I can actually do about it.

Example for message body: Szia kedves {display_name}! öüóőúéáí ÖÜÓŰŐÚÉÁÍ

Quote
- html code doesn't work in mail body,  example:<b>

Quote from: Suki on June 13, 2014, 11:20:08 AM
This is intentional. sendmail does have a setting for allowing HTML on the body, if you want to use HTML change it on the mod's code:


// Send the mail away!
foreach($messages as $m)
sendmail($m['mail'], $m['subject'], $m['message'], null, null, false);


Okay, but what is the new code? This is the original code.

Quote
- after mod uninstall, "inactive_mail", "sent_mail", and "to_delete" is remain in the database
- after mod uninstall, this mod scheduled task didn't delete.

Quote from: Suki on June 13, 2014, 11:20:08 AM
If you want to remove those settings you need to check the "Remove all data associated with this modification"  checkbox when uninstalling.

I don't remember to this settings, but now I can't install again the mod, because I get error messages:
"Database error"
Duplicate entry 'emailInactiveUsers' for key 'task'
"File": /var/www/vhosts/xxx.xxx.hu/httpdocs/test/forum-iso/Packages/temp/install.php
"line": 86
Title: Re: email Inactive Users
Post by: Suki on June 13, 2014, 11:54:34 AM
Quote
Example for message body:
Code: [Select]
Szia kedves {display_name}! öüóőúéáí ÖÜÓŰŐÚÉÁÍ

Yeah, to be honest, I'm not sure theres something I can do and even if I can, I have way too many things on my head right now, best advice I can give you is use utf8 or just use html entities directly on the subject.

I believe is the last param on sendmail($m['mail'], $m['subject'], $m['message'], null, null, false);  dunno, can't check right now.

Quote
I don't remember to this settings, but now I can't install again the mod, because I get error messages:

Yeah, thats something I need to change, just don't know when.
Title: Re: email Inactive Users
Post by: mikk on June 13, 2014, 12:46:16 PM
Quote from: Suki on June 13, 2014, 11:54:34 AM
Yeah, to be honest, I'm not sure theres something I can do and even if I can, I have way too many things on my head right now, best advice I can give you is use utf8 or just use html entities directly on the subject.
I believe is the last param on sendmail($m['mail'], $m['subject'], $m['message'], null, null, false);  dunno, can't check right now.

I think you search this: http://support.simplemachines.org/function_db/index.php?action=view_function;id=314 (http://support.simplemachines.org/function_db/index.php?action=view_function;id=314)

Anyway, thanks for answers, this mod is very good idea.
Title: Re: email Inactive Users
Post by: Suki on June 13, 2014, 02:07:55 PM
huh ???  thats what I'm using already I just couldn't remember where was the param to allow html on the body, didn't bother to search for it either since 1) I have other priorities right now and 2) when I was creating this mod I played with that setting and in 99% of all the cases it didn't work because the mail client/receiver/whatever usually strips out any html so it really is redundant to allow html on the body but like I said, if you want to allow html just change that param to true, I'm not gonna do it by default since it will only cause headaches and will not gonna work anyway.
Title: Re: email Inactive Users
Post by: senyor35 on July 06, 2014, 07:42:30 AM
When I install this mod the Scheduled Task file is gives error this line;

function($k) {

What solve please?
Title: Re: email Inactive Users
Post by: Suki on July 07, 2014, 10:30:57 AM
You shouldn't use this if you're not using PHP 5.3, theres even a check for that when installing, anyway, upload your Sources/ScheduledTask.php file
Title: Re: email Inactive Users
Post by: Impsat-1 on July 12, 2014, 11:53:47 PM
Ufff!!!... hey Suki, I´m sorry but when uninstalling and re-install the MOD, say this

Duplicate entry 'emailInactiveUsers' for key 'task'
Archivo: /home/**********/public_html/foro/Packages/temp/install.php
Línea: 86


Please help me or say me what I have to delete for install de New Version Updated for you....

I hope for solution...

Sorry for my english but I from Argentine and..... here only Spanish :)

Thanks & Regards.-
Title: Re: email Inactive Users
Post by: Impsat-1 on July 13, 2014, 12:32:31 AM
Ufff!!!... Ok Suki, Solved... from db, I delete all tables ;)


Thanks & Regards 8).-
Title: Re: email Inactive Users
Post by: Impsat-1 on July 13, 2014, 12:55:06 AM
Mmm... for any user in future, Uninstall like in pic :)




Thanks & Regards, have a great time 8).-
Title: Re: email Inactive Users
Post by: Suki on July 14, 2014, 12:34:19 PM
OK, version 1.1 was uploaded:

Adds some small improvements and fixes some other not so small bugs...

- Adds a new setting for not removing users, rather just keep annoying them with emails.
- Add Spanish translation or fix the current, dunno/don't really care.
- Move the removal of scheduled task to its own file so it can be executed eerytime the user uninstalls the mod, prevents errors when trying to install again.
To update just uninstall the mod and make sure you check the "Remove all data associated with this modification" checkbox  this is important otherwise you will have an error when trying to install the new version.
Title: Re: email Inactive Users
Post by: Impsat-1 on July 14, 2014, 10:46:34 PM
Wow!!!... Great Job Suki and so, so important detail :)

- Adds a new setting for not removing users, rather just keep annoying them with emails.

I'will try now!!!

Thanks Again... ;)

Have a Great Time
Thanks & Regards 8).-
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on July 15, 2014, 08:12:31 AM
Nice mod and thanks for the update, good new feature :)
Unless
Quote from: Suki on July 14, 2014, 12:34:19 PM
dunno/don't really care.
this is not really cool to say IMHO ;)
Title: Re: email Inactive Users
Post by: Suki on July 15, 2014, 08:23:50 AM
Why?  it is the true, I couldn't remember if the was already a translation or not. Didn't bother to look for it either.

If you're not aware already, I made my own translations, evey single of my 30-ish mods I ever made or kept updated from other authors. So yes, I am entitle to dismiss my own work if I want it to.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on July 15, 2014, 08:32:05 AM
Sure you do and sure you can (and sure I know) but, like I said, IMHO if you support a work of yours in public and you yourself claim "don't really care" then you are not very much "encouraging" it :)
Title: Re: email Inactive Users
Post by: Suki on July 15, 2014, 08:44:14 AM
That sentence was included in a log, it has nothing to do with the mod in general nor it represents how I feel about this mod.

It means that I didn't know if there was already a translation or not, don't care either way, I went ahead and made a new one. Happy?

Anyway, it is not my fault nor my problem if people misunderstand my words.  IMHO people should stop looking for drama where there is none.
Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on July 15, 2014, 08:53:18 AM
I just said that "IMHO" it didn't look cool. If you think differently is ok but don't say I look for drama -.-" because seriously I have much more important things to think about.
Title: Re: email Inactive Users
Post by: Suki on July 15, 2014, 08:58:00 AM
Please stop commenting on this topic unless you need support for this mod.

Title: Re: email Inactive Users
Post by: Kreator on July 16, 2014, 01:18:03 AM
Just out of interest what is the default Message?
Title: Re: email Inactive Users
Post by: Suki on July 16, 2014, 10:54:49 AM
Its included on the mod's language files:

https://github.com/MissAllSunday/emailInactiveUsers/blob/master/Themes/default/languages/emailInactiveUsers.english.php#L54
Title: Re: email Inactive Users
Post by: Kreator on July 16, 2014, 03:04:39 PM
thank you Suki!


great mod since installing had an influx of users!





Title: Re: email Inactive Users
Post by: Suki on July 17, 2014, 09:32:45 AM
Cool, let me know if there is any possible issue with the mod.
Title: Re: email Inactive Users
Post by: Xarkurai on July 25, 2014, 11:36:14 AM
Hello,

not sure what might cause it but when I want to do "run now" in the Scheduled Tasks it returns the following error:

"Database error, given array of integer values is empty. (groups)"

Any thoughts on this?
Cheers!
Title: Re: email Inactive Users
Post by: Suki on July 26, 2014, 09:43:35 AM
You need to specify a group ID on the mod's admin panel.
Title: Re: email Inactive Users
Post by: Xarkurai on July 26, 2014, 10:47:07 AM
Oh of course!

Thanks. Stupid me :D.
Title: Re: email Inactive Users
Post by: Suki on July 26, 2014, 10:53:28 AM
There is a logic flaw as well, I use that variable on pretty much all the queries this mod does so I should check that variable to be exactly what the queries expect. If not, don't run anything.

Will change that on another release.
Title: Re: email Inactive Users
Post by: Isa.F on August 11, 2014, 08:40:12 PM
Quote from: Suki on July 17, 2014, 09:32:45 AM
Cool, let me know if there is any possible issue with the mod.

Hi Suki! Thank's for the excellent mod!  :)

I'm getting this error on Error Log:

http://www.XXXXXXXXXX/index.php?action=admin;area=eiu;fd15434=aaa846c4ac03221e10fb62f4f5d8351a
2: in_array() expects parameter 2 to be array, boolean given
Ficheiro: /home/XXXXXXX/public_html/Themes/default/languages/emailInactiveUsers.english.php (show_settings sub template - eval?)
Linha: 903


And if I disable evaluation of templates , I get:

http://www.XXXXXXXX/index.php?action=admin;area=eiu;fd15434=aaa846c4ac03221e10fb62f4f5d8351a
2: in_array() expects parameter 2 to be array, boolean given

Ficheiro: /home/XXXXXX/public_html/Themes/default/Admin.template.php
Linha: 903



It seems to be the same error that demlak had:

Quote from: Suki on June 10, 2014, 03:10:44 PM
Quote from: demlak on May 13, 2014, 09:29:39 PM
i Just gave it a try.. is it standard, that "generel settings" and "user list" do show the same settings page "Email Inactive Users"?

i don´t see anything different on "user list"


p.s.
in the description text, there is a typo.. you wrote "not after the main was sent".. i think this should be "mail" not "main"..

p.p.s. error log says (german):
http://board.url/index.php?action=admin;area=eiu
Filter hinzufügen: Nur Fehlermeldungen mit der gleichen Nachricht anzeigen
2: in_array() expects parameter 2 to be array, boolean given
Filter hinzufügen: Nur Fehler von dieser Datei zeigen
Datei: /boardfolder/Themes/default/languages/emailInactiveUsers.english.php (show_settings sub template - eval?)
Zeile: 903



OK, I uploaded the correct package.

The "in_array() expects parameter 2 to be array, boolean given" error is an SMF bug when using a multiple select box, it only happens the first time you install the mod, by default SMF sets an non existent setting as a boolean false but the code to show the multiple select HTML code needs an array, in this case, an empty array.  I vaguely remember I fixed that on 2.1 but I don't know if I ever pushed the fix or not, will take a look at it when I get back.

Anyway, heres the correct branch, if you enable the "Disable the deletion of users feature" option then the user list will always remain empty since the change I introduced will reset the user status back to normal instead of mark the user for deletion.


Do you mean that this error will not affect the mod function , neither the function off the all the site? Can you confirm this?

This error only appears when I go to the mod definitions, but still the mod will work fine, right? 

I am asking you this just to make sure if I understand right what you wrote. I confess that I'm a little worried because I really do not want members to be deleted. I have already "Disable the deletion of users"... but steel afraid that something goes bad...  :-[ :-[ 

Are you predicting to release a new version that do not contain this issue?

Thank you for your time, and congratulations for the mod  ;)




Note: I'm using SMF 2.0.8 and I didn't have any error in the mod installation


PS: sorry for my English...
Title: Re: email Inactive Users
Post by: Suki on August 12, 2014, 10:13:27 AM
No, that bug won't cause any issue with your forum nor it will automatically delete your members... as I explained before, this is an SMF bug and it has nothing to do with what this mod does....

It will go away as soon as you select 1 or more membergroups and click save.

No, I don't plan to release a new version because of this bug, every mod that uses that feature has the same issue, its a minor one and it doesn't even interfere with what the mod does, its also pretty easy to erase, all you have to do is select a membergruop which is something you will have to do anyway...
Title: Re: email Inactive Users
Post by: Isa.F on August 12, 2014, 07:02:49 PM
Quote from: Suki on August 12, 2014, 10:13:27 AM
No, that bug won't cause any issue with your forum nor it will automatically delete your members...

I'm so relieved, thank you!  :)

Quote from: Suki on August 12, 2014, 10:13:27 AM
as I explained before, this is an SMF bug and it has nothing to do with what this mod does....

It will go away as soon as you select 1 or more membergroups and click save.

No, I don't plan to release a new version because of this bug, every mod that uses that feature has the same issue, its a minor one and it doesn't even interfere with what the mod does, its also pretty easy to erase, all you have to do is select a membergruop which is something you will have to do anyway...


You mean that when I select a membergruop in this section of the mod General settings....:

Quoteselect the groups who will be affected by this mod
This is a multi-select box, only the users who have the selected groups as primary or secondary groups would be affected by the mod, the default admin group cannot be selected.

...I will not have this error again. Right?  :)


Ok! I think I understood!   :)


Thanks again!  :)
Title: Re: email Inactive Users
Post by: dougiefresh on November 02, 2014, 05:09:11 PM
I need to file a bug report about this mod.  My server is running PHP 5.4.33 and when I install your mod, it tells me this:
QuoteThis mod needs PHP 5.3 or greater. You will not be able to install/use this mod, contact your host and ask for a php upgrade.
Please fix this, as it is a mod that I really would like to have on my forum!  Thanks!
Title: Re: email Inactive Users
Post by: Padre gremista on November 02, 2014, 05:58:52 PM
Is possible send email for inactive users, without exclude users?
Title: Re: email Inactive Users
Post by: Suki on November 03, 2014, 08:20:01 AM
Quote from: dougiefresh on November 02, 2014, 05:09:11 PM
I need to file a bug report about this mod.  My server is running PHP 5.4.33 and when I install your mod, it tells me this:
QuoteThis mod needs PHP 5.3 or greater. You will not be able to install/use this mod, contact your host and ask for a php upgrade.
Please fix this, as it is a mod that I really would like to have on my forum!  Thanks!

I use version_compare to determinate the php version.

If you are indeed using 5.4 then just uncomment the function check on install.php. Nothing to fix here.

Quote from: Padre gremista on November 02, 2014, 05:58:52 PM
Is possible send email for inactive users, without exclude users?

I'm sorry, I didn't understand your question, if you mean using this mod to send mails to every user then no.
Title: Re: email Inactive Users
Post by: Padre gremista on November 03, 2014, 12:14:51 PM
Quote from: Suki on November 03, 2014, 08:20:01 AM
Quote from: dougiefresh on November 02, 2014, 05:09:11 PM
I need to file a bug report about this mod.  My server is running PHP 5.4.33 and when I install your mod, it tells me this:
QuoteThis mod needs PHP 5.3 or greater. You will not be able to install/use this mod, contact your host and ask for a php upgrade.
Please fix this, as it is a mod that I really would like to have on my forum!  Thanks!

I use version_compare to determinate the php version.

If you are indeed using 5.4 then just uncomment the function check on install.php. Nothing to fix here.

Quote from: Padre gremista on November 02, 2014, 05:58:52 PM
Is possible send email for inactive users, without exclude users?

I'm sorry, I didn't understand your question, if you mean using this mod to send mails to every user then no.

My question is if the member inactive are erased. Sorry for my poor english.
Title: Re: email Inactive Users
Post by: Suki on November 03, 2014, 12:40:54 PM
The mod has a setting to disable users deletion, if you use that setting, the mod will not delete any users, it will just keep on email them.
Title: Re: email Inactive Users
Post by: dougiefresh on November 03, 2014, 07:31:13 PM
Quote from: Suki on November 03, 2014, 08:20:01 AM
I use version_compare to determinate the php version.

If you are indeed using 5.4 then just uncomment the function check on install.php. Nothing to fix here.
I did that, then I got an error in Sources/ScheduledTasks.php, where this code gave me errors:
// We gotta do a nasty thing here, we have to format a "FIND_IN_SET" for each selected group. Thanks to this we need PHP 5.3 or grater...
if (!empty($inGroups))
$additionalgroups = array_map(
function($k) {
return ' OR FIND_IN_SET('. $k .', additional_groups)';
}, $inGroups);

// For those who still want to use this but don't have php 5.3
/* if (!empty($inGroups))
foreach ($inGroups as $k)
$additionalgroups[] = ' OR FIND_IN_SET('. $k .', additional_groups)'; */

I found this weird....  I commented out the first part and uncommented the second and it appears to work....  (Haven't tested it live, though)

Question #1:  Why do the first part when the second part of this works just fine?  :o

Question #2:  If I'm running PHP 5.4.x (cause that's what my cPanel says I'm running), why would this generate errors?  This I don't understand....  ???
Title: Re: email Inactive Users
Post by: Suki on November 03, 2014, 07:58:39 PM
It looks like you're not really running 5.4

Create a test file with phpinfo() on it to know what version you are using.

If the second part works then you are using something below php 5.3.

There is no particular reason as to why I used a closure and thus forcing php 5.3, it makes life easier for me thats all.  I provided the fallback code because it was easy to provide it.
Title: Re: email Inactive Users
Post by: dougiefresh on November 03, 2014, 08:05:58 PM
Huh....  I'm sorry....  I shoulda thought about doing that before I posted.   phpinfo says that my server is running PHP 5.2.17, NOT 5.4.somethingorother.....  I'm gonna have to talk to my server company about that cause that's just screwed up....  Thank you for helping me figure this one out!
Title: Re: email Inactive Users
Post by: Shkic on December 04, 2014, 07:17:44 AM
Firstly I want to thank you for the mod :)

I'm also have PHP 5.2.17 so I understand, that basically we need PHP 5.3 for this:

// We gotta do a nasty thing here, we have to format a "FIND_IN_SET" for each selected group. Thanks to this we need PHP 5.3 or grater...
if (!empty($inGroups))
$additionalgroups = array_map(
function($k) {
return ' OR FIND_IN_SET('. $k .', additional_groups)';
}, $inGroups);


? Then why you include a quoted code for those who don't have 5.3?

   // For those who still want to use this but don't have php 5.3
/* if (!empty($inGroups))
foreach ($inGroups as $k)
$additionalgroups[] = ' OR FIND_IN_SET('. $k .', additional_groups)'; */


I guess mod will fully work if I replace the first code with second one? I'm right? :)
Title: Re: email Inactive Users
Post by: Suki on December 04, 2014, 08:44:20 AM
Because it was an easy fix to include.

This particular mod didn't really needed php 5.3 but I made it so because it is easier for me to maintain it.

Yes, the mod will fully work if you uncomment that line and comment the other one.
Title: Re: email Inactive Users
Post by: Arantor on December 04, 2014, 11:52:10 AM
PHP 5.2.x is insecure, please advise your host of this.
Title: Re: email Inactive Users
Post by: TonyG on December 25, 2014, 11:35:14 PM
Greetings. I just  loaded SMF 2.0.9 and v1.1 of this mod, and I'm looking forward to booting deadbeat members. Thanks! LOL!

I have a number of these in this new installation.

Quotehttp://.../index.php?scheduled=task;ts=1419379200
Database error, given array of integer values is empty. (groups)
Function: scheduled_emailInactiveUsers
File: /home/.../forum/Sources/ScheduledTasks.php
Line: 1730

There are only two users registered, my admin user and one test member.
The mod is enabled but no, I have not set any groups. I was thinking that if none were set then the default might have been that the selection applied to all groups. So I'm setting a number of groups and will post back here if this error persists.
I think a code change was made for this back in June but since I just downloaded the package and I get this error, this is half an inquiry as to whether I should do something else, and half an FYI that the issue persists in the current release.

Thanks.
Title: Re: email Inactive Users
Post by: Suki on December 26, 2014, 10:10:25 AM
Yes, it is a known issue, a logic one, will see if I have some time today to push a fix for it.
Title: Re: email Inactive Users
Post by: Suki on December 26, 2014, 12:37:07 PM
OK, new version 1.1.1 (https://github.com/MissAllSunday/emailInactiveUsers/releases/tag/v1.1.1)

The green button is a "ready to install" package.

Also updated the download here (http://custom.simplemachines.org/mods/index.php?mod=3849).


To upgrade just uninstall the old version and install the new one via the package manager.
Title: Re: email Inactive Users
Post by: TonyG on December 26, 2014, 04:42:03 PM
Thanks! I'll update, remove the groups to assume "all", and let you know if any more errors are logged.
Title: Re: email Inactive Users
Post by: Suki on December 26, 2014, 04:54:52 PM
Well, you need to select the groups you specifically want the mod to be applied to, if you don't select any, then the mod will simply not do anything.

Title: Re: email Inactive Users
Post by: TonyG on December 26, 2014, 06:29:27 PM
That's fine, I'm just checking to see if it'll report errors. I have a new board, no live members yet. It'll be a while before we can flag any of them as being inactive.
Title: Re: email Inactive Users
Post by: phpshiva on January 11, 2015, 06:31:55 AM
I got errors when code is at bottom from scheludetask as mebers ask for forgotton password
i put it in just a bit up and i see no errors now
Title: Re: email Inactive Users
Post by: Suki on January 11, 2015, 10:18:54 AM
Without knowing which errors you got it is impossible to help you...
Title: Re: email Inactive Users
Post by: ben sisko on January 15, 2015, 07:41:52 AM
hello,

i'm getting this error when trying to reinstall the mod after the upgrade from 2.0.8 to 2.0.9:
Duplicate entry 'emailInactiveUsers' for key 'task'
File: /home/xxx/public_html/Packages/temp/install.php
Line: 86
Title: Re: email Inactive Users
Post by: margarett on January 15, 2015, 09:19:01 AM
The scheduled task wasn't removed at uninstall. You need to go to phpmyadmin, SMF database, table smf_scheduled_tasks, then find and remove the row that has the column "task" = emailInactiveUsers
Title: Re: email Inactive Users
Post by: petewadey on March 03, 2015, 10:55:03 AM
Hi Suki,
Thanks for a great mod.
I've just installed and I'm a bit confused as how to select a user group from the ones listed. Am I missing the point somewhere? Is see a drop down list but no way of selecting from it?
Also, Is there a way of choosing old members that have never logged on to be sent the mail?
Thanks,
Pete
Title: Re: email Inactive Users
Post by: Suki on March 03, 2015, 01:54:57 PM
You just need to click on the selected group and save the changes.

As for selecting old members you just need to specify how many days had passed since their last log in, the mod checks the register date too so even if they haven't logged in the mod should catch those users too.
Title: Re: email Inactive Users
Post by: petewadey on April 14, 2015, 07:18:32 PM
Thanks,
I have now mistakenly  marked some users as being safe from deletion. Is there a way of reversing that?
Thanks.
Pete
BTW Great Mod :-)
Title: Re: email Inactive Users
Post by: Suki on April 15, 2015, 12:56:33 PM
How many users did you marked?  do you know the IDs of those users?

Are you familiar with php?  if so this is the query that deals with changing the user status, just replace the 4 with 0

$request = $smcFunc['db_query']('', '
UPDATE {db_prefix}members
SET to_delete = {int:toDelete}, inactive_mail = 0
WHERE id_member IN ({array_int:users})',
array(
'toDelete' => 4,
'users' => $usersToProtect,
)
);



$usersToProtect is an array of user IDs you want to change.
Title: Re: email Inactive Users
Post by: petewadey on April 15, 2015, 01:16:38 PM
I marked 6 users as safe from deletion and know their usernames. If the only way to unmark them is to change the php, would uninstalling the programe and re installing it work? as I'm not confident enough to  alter php.
Thanks
Pete
Title: Re: email Inactive Users
Post by: Suki on April 15, 2015, 02:14:09 PM
No, uninstalling the mod will not do what you want, you don't need to alter your php either, you will need to run a separate script, unfortunately, I do not have enough time to write that script for you.
Title: Re: email Inactive Users
Post by: partners on April 22, 2015, 06:13:27 PM
Hi Suki,
Thank you for the MOD. We installed it but how do we tell if it is working?
We have a dummy account and have not logged in for a while but we never received an email.
We have SMF 2.0.7 .

Thank you again.
Title: Re: email Inactive Users
Post by: Suki on April 23, 2015, 10:03:26 AM
The mod doesn't automatically delete users, when an user has reached all the criteria for deletion that user will appear on a special list page where you can manually set them for deletion.

Do check that your test user has reached the criteria you set up.
Title: Re: email Inactive Users
Post by: partners on April 23, 2015, 05:15:07 PM
OK, thank you.
When we look in Task Log we can not see that it is running.
Is that normal?

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 23, 2015, 06:40:18 PM
The mod doesn't add any log.

Take a look at your list of scheduled tasks, there should be a new taks named "email inactive users" or something like that, make sure its enable.
Title: Re: email Inactive Users
Post by: partners on April 25, 2015, 04:56:01 PM
Hi Suki,
Yes it is enabled but we don't think it is sending the email.
Could we pay you to look at it if that is allowed?

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 25, 2015, 05:52:26 PM
It is pretty difficult to debug this not knowing any details at all.

Does your forum sends emails?

Do you have any users in the user list?

Whats the setting you set up for the "How many days since their last log in to receive the email" option?
Title: Re: email Inactive Users
Post by: partners on April 26, 2015, 02:26:43 PM
Hi Suki,
Thank you replying.
Yes our forum sends email.
We have it set not to delete users so there are no users listed but we did uncheck this box for one day and checked and there were no users listed.
We have this value "How many days since their last log in to receive the email" set to 15.

We are a little stumped but we thank you for the mod and trying to help us.

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 01:57:52 PM
OK, lets figure it out of your forum does have any users that match the criteria you have.

create a new .php file inside your forum's root folder (the one where SSI.php resides) with this code:


<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');

else if(!
defined('SMF'))
die('<b>Error:</b> please verify you put this in the same place as SMF\'s index.php and SSI.php files.');

if ((
SMF == 'SSI') && !$user_info['is_admin'])
die('Admin privileges required.');

// Today is a good day to do stuff don't you think?
$today time();
$additionalgroups = array();
// Is there any custom message?
$customMessage = !empty($modSettings['eiu_message']) ? $modSettings['eiu_message'] : $txt['eiu_custom_message'];
$customSubject = !empty($modSettings['eiu_subject']) ? $modSettings['eiu_subject'] : $txt['eiu_custom_subject'];
$postLimit = !empty($modSettings['eiu_posts']) ? $modSettings['eiu_posts'] : 5;
// How many days must the user needs to be inactive to get the mail? lets stay safe here and declare a default value too.
$inactiveFor 86400 * (!empty($modSettings['eiu_inactiveFor']) ? $modSettings['eiu_inactiveFor'] : 15);
// The user hasn't been logged in since the mail was sent huh? how many days are we gonna wait until the account gets marked for deletion?
$sinceMail 86400 * (!empty($modSettings['eiu_sinceMail']) ? $modSettings['eiu_sinceMail'] : 15);
// The groups from which the users will be fetched from.
$inGroups = !empty($modSettings['eiu_groups']) ? unserialize($modSettings['eiu_groups']) : array();
// There's gotta be at least 1 group.
if (empty($inGroups) || !is_array($inGroups))
return true;
// Don't count the main admin group, AKA id_group 1
$inGroups array_diff($inGroups, array(1));
// We gotta do a nasty thing here, we have to format a "FIND_IN_SET" for each selected group. Thanks to this we need PHP 5.3
$additionalgroups array_map(
function($k) {
return ' OR FIND_IN_SET('$k .', additional_groups)';
}, $inGroups);
// For those who still want to use this but don't have php 5.3
/* foreach ($inGroups as $k)
$additionalgroups[] = ' OR FIND_IN_SET('. $k .', additional_groups)'; */

// Right, we got all we need, lets do some expensive queries.
$request $smcFunc['db_query']('''
SELECT id_member, email_address, inactive_mail, member_name, real_name, last_login
FROM {db_prefix}members
WHERE inactive_mail = 0
AND posts <= {int:postLimit}
AND last_login < {int:inactiveFor}
AND date_registered < {int:inactiveFor}
AND is_activated = 1
AND to_delete = 0
AND email_address is NOT NULL
AND (id_group IN ({array_int:groups})
OR id_post_group IN ({array_int:groups})
'
. (implode(' '$additionalgroups)). ')',
array(
'inactiveFor' => $today $inactiveFor,
'groups' => $inGroups,
'postLimit' => $postLimit,
)
);
$messages = array();
while($row $smcFunc['db_fetch_assoc']($request))
{
// Lets create the message. Replace our wildcards with the actual data.
$replacements = array(
'{user_name}' => $row['real_name'],
'{display_name}' => $row['member_name'],
'{last_login}' => timeformat($row['last_login']),
'{forum_name}' => $mbname,
'{forum_url}' => $scripturl,
);
// Split the replacements up into two arrays, for use with str_replace.
$find = array();
$replace = array();
foreach ($replacements as $f => $r)
{
$find[] = $f;
$replace[] = $r;
}
$messages[$row['id_member']] = array(
'message' => str_replace($find$replace$customMessage),
'mail' => $row['email_address'],
'subject' => str_replace($find$replace$customSubject),
);
}

if(empty($messages))
echo 'There aren\'t any users that match the criteria';

else
var_dump($messages);


Name it whatever you want, something like testemailMod.php or something  and then call it with your browser:

yoursite.com/forum/testemailMod.php

replacing "yoursite.com" with the actual name of your site

This script mimics this mod behavior without actually send and email and will list all people who match the criteria you have set up.

If you see this message:  "There aren't any users that match the criteria"  then it means you need to configure your mod settings properly since there aren't any users eligible for sending them an email.

If the script returns a list of messages to send then it means you have users matching the criteria but somehow the mod is failing to send mails.
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 02:38:56 PM
Hi Suki,

Ok we did this and the page says "Admin privileges required."

Is this a permission problem?
Thank you for your help.

Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 02:42:09 PM
yes, its a security measure, please log in on your site as admin and run the script with the same browser you logged in as an admin
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 02:51:21 PM
OK, we did this and it has a huge page of users to send the message to.
In our FTP program the /public_html/Packages/eIU.zip has the owner being 99.
Could this be the problem?

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 02:55:25 PM
OK, if you got a list of mesages then it means something is actually wrong with this mod, let me check further on this as I just did a quick code check and some stuff just doesn't seem right.
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 03:00:54 PM
OK, thank you.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 03:33:41 PM
OK another attempt,

replace the entire file content with this:


<?php

if (file_exists(dirname(__FILE__) . '/SSI.php') && !defined('SMF'))
require_once(dirname(__FILE__) . '/SSI.php');

else if(!
defined('SMF'))
die('<b>Error:</b> please verify you put this in the same place as SMF\'s index.php and SSI.php files.');

if ((
SMF == 'SSI') && !$user_info['is_admin'])
die('Admin privileges required.');

require_once(
$sourcedir '/Subs-Post.php');

$mail '';

sendmail($mail'test''this is a test message'nullnullfalse);


fill out the $mail = ''; var with the mail of your test account:

$mail = 'test@something';

and run the script with your browser again, this will directly try to send a mail to that mail account, please see if the mail was sent or received on that mail account.
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 03:51:20 PM
OK, we did this and we received the test email.

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 03:58:23 PM
thats weird then because the mod uses sendmail immediately after retrieving the users.

Are you sure you have the scheduled task created in your DB table?  can you please verify that inside table "scheduled_tasks" there is a row named "emailInactiveUsers"  and that it has the "disabled" column set to 1 ?
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 04:03:25 PM
Can you tell us how to do this?

Sorry.

Thank you.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 04:05:30 PM
if you have cpanel or similar look for "phpmyadmin" thats a tool where you can check your DB tables, pick your db, then pick the cheduled task table and you wioll be able to see its content.
Title: Re: email Inactive Users
Post by: RSI on April 27, 2015, 04:11:14 PM
I don't know about anyone else but I've tried this mod a few times in the past couple of years or close to it and I never could get it to work. It always installed fine, but it never did do anything.

I've often wondered if it was because it only works with members who join after the mod is installed, because I had members who had not logged on in more than 3 years and I wanted it to delete their accounts, but the mod never did anything when I tried to make it work to remove those accounts in a short amount of time after I installed it. Like the other guy nothing ever appeared on the users marked for deletion list.

I installed it again early last week when this topic first appeared again and it still doesn't do anything and never sends out any emails either.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 04:20:03 PM
RSI do you have any users marked as ready for deletion?  does your forum sends out mails?

No, the mod does not work only for users registered after the mods was installed but it does have a lot of checks and any misconfiguration can make it not to send any mails.
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 04:21:50 PM
Suki,

OK it does have this value:
disabled   tinyint(3)  and the value is set to 0.

Do we need to change this to 1?

Thanks
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 04:24:53 PM
yes, that specific value needs to be set to 1 otherwise the scheduled task will never run.

scratch that... yes it needs to be set to 0  so leave it as it is.
Title: Re: email Inactive Users
Post by: RSI on April 27, 2015, 04:28:53 PM
Quote from: Suki on April 27, 2015, 04:20:03 PM
RSI do you have any users marked as ready for deletion?  does your forum sends out mails?

Yes, it sends out emails.

Quote from: Suki on April 27, 2015, 04:20:03 PM
No, the mod does not work only for users registered after the mods was installed but it does have a lot of checks and any misconfiguration can make it not to send any mails.

I never have had any luck with it working. What would be connected to the "lot of checks" as far as a misconfiguration is concerned? Are there any other typical board settings that could cause it not to work?
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 04:34:31 PM
it might be a bug in the mod, I haven't checked and I can't check right now either.  Will review the mod onces again when I have some time.
Title: Re: email Inactive Users
Post by: partners on April 27, 2015, 04:43:11 PM
OK, we left it at 0.

Thank you.
Title: Re: email Inactive Users
Post by: RSI on April 27, 2015, 04:50:29 PM
Quote from: Suki on April 27, 2015, 04:34:31 PM
it might be a bug in the mod, I haven't checked and I can't check right now either.  Will review the mod onces again when I have some time.

That's why I spoke up. I've even made sure the Scheduled Task settings were correct and even tried manually running it a few times and nothing...

I guess there could always be some other setting that conflicts with it. I do have the permission set where users cannot delete their own accounts or their posts, but wouldn't the mod be using the board's admin account anyway?. I've seen where the no permission to delete posts setting conflicts with another board setting and won't let it automatically prune topics when it's enabled.

None of that would explain why it wont send out any emails when I try to make it work though, right?

P.S. I do have the Mail Queue enabled and always have.

.
Title: Re: email Inactive Users
Post by: Suki on April 27, 2015, 07:35:24 PM
OK, I just set up a test forum on my server and installed this mod, checked with 2 accounts and both received the mail

RSI can you do the steps listed here http://www.simplemachines.org/community/index.php?topic=521464.msg3808007#msg3808007

This are all the checks an user must pass in order to receive an email:

WHERE inactive_mail = 0  // an email hasn't been sent for this user
AND posts <= {int:postLimit}  // the suer has less post than the mod's setting
AND last_login < {int:inactiveFor}  // the user hasn't been logged in since the time in the mod's setting
AND date_registered < {int:inactiveFor} // the user registered date is lower than the mod's setting
AND is_activated = 1 // the user's account needs to be activated
AND to_delete = 0  // hasn't been marked for deletion yet
AND email_address is NOT NULL  // has an email address
AND (id_group IN ({array_int:groups}) // has X primary group
OR id_post_group IN ({array_int:groups}) // or has X group as secondary

The only check I can see causing issues is the date_registered, I remember I applied that check for a reason but I can't remember why :P

The other thing is the "is_activated"  which can reduce the number of people to ever receiving an email, if your forum has a bunch of inactive accounts then those accounts will never receive an email since it hasn't been activated yet.

Other than that I can only suggest that you configure the mod settings properly, that is, check and double check the list of groups that are eligible to sent mails to them, check the post count too, if it is too low then a lot of users will be skipped.

@partners  In your case you do have valid users but for some reasons the sendmail function fails to send all those emails, perhaps it could be a server issue?  do you have the mail queue enable?  any error in your server logs?
Title: Re: email Inactive Users
Post by: RSI on April 28, 2015, 10:25:40 AM
Quote from: Suki on April 27, 2015, 07:35:24 PM
RSI can you do the steps listed here http://www.simplemachines.org/community/index.php?topic=521464.msg3808007#msg3808007

This are all the checks an user must pass in order to receive an email:

WHERE inactive_mail = 0  // an email hasn't been sent for this user
AND posts <= {int:postLimit}  // the suer has less post than the mod's setting
AND last_login < {int:inactiveFor}  // the user hasn't been logged in since the time in the mod's setting
AND date_registered < {int:inactiveFor} // the user registered date is lower than the mod's setting
AND is_activated = 1 // the user's account needs to be activated
AND to_delete = 0  // hasn't been marked for deletion yet
AND email_address is NOT NULL  // has an email address
AND (id_group IN ({array_int:groups}) // has X primary group
OR id_post_group IN ({array_int:groups}) // or has X group as secondary

The only check I can see causing issues is the date_registered, I remember I applied that check for a reason but I can't remember why :P

The other thing is the "is_activated"  which can reduce the number of people to ever receiving an email, if your forum has a bunch of inactive accounts then those accounts will never receive an email since it hasn't been activated yet.

Other than that I can only suggest that you configure the mod settings properly, that is, check and double check the list of groups that are eligible to sent mails to them, check the post count too, if it is too low then a lot of users will be skipped.

Thanks, I'll check it when I have the time again, I had already uninstalled the mod before posting yesterday. I need to focus on a couple of other more important things right now.
Title: Re: email Inactive Users
Post by: Suki on April 28, 2015, 11:19:28 AM
Ah! always good to know staying awake all night trying to offer support is labeled as not that important.  Surely keeps you motivated...
Title: Re: email Inactive Users
Post by: partners on April 28, 2015, 02:06:21 PM
Hi Suki,

Thank you, we will check and get back.

Thank you again.
Title: Re: email Inactive Users
Post by: partners on April 28, 2015, 04:11:56 PM
Suki,

Our forum is sending email and we do not have any errors in our log.
We will try uninstall and re-install and see what happens.

Thank you for your help.
Title: Re: email Inactive Users
Post by: Suki on April 29, 2015, 10:09:30 AM
Then I'm afraid I'm stumbled here :(
Title: Re: email Inactive Users
Post by: eldritch1969 on April 29, 2015, 11:06:46 AM
Well, just want to say that the mod works for my forum and I have a User List for 134 users marked for deletion.

I currently use SMF 2.0.9
Title: Re: email Inactive Users
Post by: partners on April 29, 2015, 02:28:19 PM
No worries Suki.
Thank you for trying to help us.
Title: Re: email Inactive Users
Post by: partners on April 29, 2015, 05:21:54 PM
Suki,
Do you think Pretty URL's could be causing this?

Thank you.
Title: Re: email Inactive Users
Post by: sah62 on June 08, 2015, 02:06:11 PM
I'm running version 1.1.1 of this mod as downloaded from GitHub. It seems to be working fine, but I'm getting a pair of errors logged every time I visit the "General Settings" page. This is what's in the log:


2: in_array() expects parameter 2 to be array, boolean given
File: /home/public_html/forum/Themes/default/emailInactiveUsers.template.php (show_settings sub template - eval?)
Line: 903



2: unserialize() expects parameter 1 to be string, array given
File: /home/public_html/forum/Sources/ManageServer.php
Line: 1877


Do these errors look familiar to anyone?
Title: Re: email Inactive Users
Post by: Suki on June 16, 2015, 07:19:57 PM
You are prob using an outdated version of SMF, it you search this topic it has been mentioned a few times already, its not really a major bug and it goes away as soon as you select a membergroup or update to SMF 2.0.10
Title: Re: email Inactive Users
Post by: sah62 on June 16, 2015, 08:21:19 PM
Quote from: Suki on June 16, 2015, 07:19:57 PM
You are prob using an outdated version of SMF, it you search this topic it has been mentioned a few times already, its not really a major bug and it goes away as soon as you select a membergroup or update to SMF 2.0.10

I'm using SMF 2.0.10. All file versions are up-to-date.

I saw your response in this reply:

http://www.simplemachines.org/community/index.php?topic=521464.msg3706248#msg3706248

I've tried setting "Disable the deletion of users feature". The log messages continue no matter what this option is set to. I've also tried selecting a membergroup and that doesn't seem to change anything, either.
Title: Re: email Inactive Users
Post by: ocbland4 on June 16, 2015, 11:07:54 PM
Thanks for share this
Title: Re: email Inactive Users
Post by: Suki on June 17, 2015, 09:36:38 AM
Quote from: sah62 on June 16, 2015, 08:21:19 PM
Quote from: Suki on June 16, 2015, 07:19:57 PM
You are prob using an outdated version of SMF, it you search this topic it has been mentioned a few times already, its not really a major bug and it goes away as soon as you select a membergroup or update to SMF 2.0.10

I'm using SMF 2.0.10. All file versions are up-to-date.

I saw your response in this reply:

http://www.simplemachines.org/community/index.php?topic=521464.msg3706248#msg3706248

I've tried setting "Disable the deletion of users feature". The log messages continue no matter what this option is set to. I've also tried selecting a membergroup and that doesn't seem to change anything, either.

The "Disable the deletion of users feature" has nothing to do with this issue, it was something the other user asked for, not relevant to your issue.

You need to select a membergroup and SAVE the changes.

If you are indeed using 2.0.10 then on your ./Sources/ManageServer.php file you should have this exact same line:



$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();


Thats the line that fixes your issue and it has been included in SMF 2.0.9.
Title: Re: email Inactive Users
Post by: sah62 on June 18, 2015, 10:28:05 AM
Quote from: Suki on June 17, 2015, 09:36:38 AM
The "Disable the deletion of users feature" has nothing to do with this issue, it was something the other user asked for, not relevant to your issue.

You need to select a membergroup and SAVE the changes.

If you are indeed using 2.0.10 then on your ./Sources/ManageServer.php file you should have this exact same line:



$context['config_vars'][$config_var[1]]['value'] = !empty($context['config_vars'][$config_var[1]]['value']) ? unserialize($context['config_vars'][$config_var[1]]['value']) : array();


Thats the line that fixes your issue and it has been included in SMF 2.0.9.

That line is present exactly as written above.

One thing I noticed, though: I can't seem to save membergroup selections. I can select multiple groups, but when I click on "Save" to save the settings they are not selected when the page is redisplayed. Should the groups be visibly selected after saving the settings?
Title: Re: email Inactive Users
Post by: Suki on June 18, 2015, 10:37:42 AM
Can you attach your Sources/ManageServer.php file here please.

Does your host allows serialize() to be used?

Does the other settings gets saved correctly?
Title: Re: email Inactive Users
Post by: sah62 on June 18, 2015, 11:09:21 AM
Quote from: Suki on June 18, 2015, 10:37:42 AM
Can you attach your Sources/ManageServer.php file here please.

File attached.

Quote
Does your host allows serialize() to be used?

Yes, I run my own server. PHP version is PHP 5.5.9-1ubuntu4.9.

Quote
Does the other settings gets saved correctly?

Yes, it seems so. I can check and uncheck options, enter integer values, and set text for email just fine.  The only issue appears to be with saving group selections.
Title: Re: email Inactive Users
Post by: Topman on July 13, 2015, 07:28:50 AM
Quote from: Suki on April 23, 2015, 06:40:18 PM
The mod doesn't add any log.

Take a look at your list of scheduled tasks, there should be a new taks named "email inactive users" or something like that, make sure its enable.

Hi Suki,
Thanks for this  great mod and something that is very much needed.

I looked in scheduled tasks and unchecked the enable "email inactive users" and checked run now.
I got the message:
"Wrong value type sent to the database. Integer expected. (sinceMail)"  (minus the " ")

I then clicked my e mail and have received e mails responses from my test accounts and mail non-delivery e mails from members with email accounts that no longer work.
So can I assume it works?  I am using 2.0.10 and installed the Mod today.

On another matter, I assume if you change the default message sent you need to ad {user_name} to the text as that with the {} as well for the user_name or the other things to work?
Title: Re: email Inactive Users
Post by: Topman on July 13, 2015, 07:30:24 AM
Actually, I think it has worked as one of my "wayward" members is online and having a look at the forum right now!
Title: Re: email Inactive Users
Post by: aegersz on July 13, 2015, 07:58:24 AM
I also could use the non-deleting version too.

thanks, I just want to send reminders, please.
Title: Re: email Inactive Users
Post by: Topman on July 13, 2015, 08:04:59 AM
Just add 100,000 days to the setting for deleting.
If you are still alive in 273 years time re set it or un-enable it.

I must admit the "deleting members" feature is a bit unnecessary as this can be done manually quite easily.
Title: Re: email Inactive Users
Post by: aegersz on July 13, 2015, 05:42:00 PM
because I see SMF as wonderful forumware so it deserves an elegant feature admin panel of such options.

but thanks for the input ... I'm a forum nut so I appreciate connecting to fellow enthusiasts.
Title: Re: email Inactive Users
Post by: Topman on July 14, 2015, 01:41:00 AM
I have just deactivated "email inactive members" as it is sending the e mail to them everyday!
That sort of spam wont bring them back and get my forum a bad name.
Good for 3-4 times a year though.
Title: Re: email Inactive Users
Post by: Miker1029 on August 05, 2015, 12:31:19 PM
Hey just installed this MOD and so far so good, set it for 173 days + 7 for grace period, Had a couple questions, 1 as I understand from reading Users WON'T Show up on the Deletion List till 24hrs before the actual deletion?!?!?

AND Is there a way to send myself a test E-mail to see how it looks??  I tried looking for a Last Active MOD or something to change it on a TEST account, but couldn't find anything....

AND GREAT MOD SO FAR!!!   Love IT!

Mike
Title: Re: email Inactive Users
Post by: Suki on August 05, 2015, 01:01:08 PM
Quote from: Miker1029 on August 05, 2015, 12:31:19 PM
1 as I understand from reading Users WON'T Show up on the Deletion List till 24hrs before the actual deletion

From the mod's description:

Quote
- Once the user has received the email and the grace period has expired, (s)he will appear on the mod's user list, on that list you can:
   - Mark the user for deletion. The user will be deleted the next time the scheduled task gets executed, there is a small chance for the user to skip deletion if (s)he logs in between the time the admin marked their account for deletion and the time the scheduled task gets executed, this timeframe, however, could be very small and it cannot be larger than a full day.
   - Mark the user as "untouchable" This special setting tells the mod to completely ignore this account, that is, the account won't be eligible for deletion even if it complies with all of the criteria.

It means the mod sends out an email if the user meets the criteria, then and ONLY then it gets added to the "delete list" and it will only be deleted IF you mark that user for deletion.

The email is just plain text, the generic message can be seen at:  https://github.com/MissAllSunday/emailInactiveUsers/blob/master/Themes/default/languages/emailInactiveUsers.english.php#L54

The only thing that changes is the {tokens}. The mod won't support HTML on mails.
Title: Re: email Inactive Users
Post by: Miker1029 on August 05, 2015, 01:21:15 PM
Oh Wow, so I actually have to Approve the Deletion? And Yes I read that, Just kind of Confused me, So I Guess, That as "Criteria" that means the Time Frame/Group/and GRACE PERIOD, It sent out 2 Pages of mails, so I know that part worked fine, Just they didn't show up on the deletion list, as you said criteria hasn't been met...

IF I'm correct on the "Approve Deletion" is there a way that I can just have them Deleted WITHOUT my intervention, I pretty Much want it set as AN Automatic system....

Thanks

Mike
Title: Re: email Inactive Users
Post by: Suki on August 05, 2015, 01:35:52 PM
No, there is currently no way to automatically delete users, it can be done sure but I won't be adding that feature simply because I don't want to be blamed for any possible incorrect usage of it (aka, your mod deleted all my users).

Thats  why the mod has been specifically built to let the admin decide what to do with those accounts (effectively washing my hands off from any responsibility).  Depending on how busy is your forum, checking the list once per week should be enough, AFAIK the mod has a "select all" checkbox so the only thing you need to do is mark that box.
Title: Re: email Inactive Users
Post by: Miker1029 on August 05, 2015, 01:59:20 PM
Ok Ya True, I can see that as being a major issue!   But a Tick Box Option With a STRONGLY WORDED WARNING, Might fix that kind of issue...If I TICK And LOSE IT It's on me for not testing it.....

And a Warning E-Mail to the ADMIN that says 1862 Members are fixing to be deleted and after this deletion you'll have Exactly 0 left so you might want to log-in to verify this action as you'll have exactly 0 members left after this action is performed. (or something along those lines...)  8-)  (SMART A$$ Example)

As a WORKING Automatic system it'd be very nice, And ya just going in to a click-all works, But options are a beautiful  thing 8-)

The reason I'm bringing it up, I'm at the Moment, Setting up, FAKE E-Mail/SPAM Prevention and Forum Misuse Blocking, And As it is once a month (or so) I have to Newsletter to all members to get Bounces to delete fake accounts, SO I added E-Mail Name Block and just added about 300 Fake Providers to the Block, and now your MOD...

The Goal To bring my user base down to USERS that Actually USE 8-)  I'm not impressed by 1800+ users, I'd rather have 100 That Participate.....

IMHO, Just putting the idea out there.. Maybe some others will speak up on it....


Mike
Title: Re: email Inactive Users
Post by: Topman on August 07, 2015, 02:59:11 AM
For a start set up a member account for yourself (with no posts) and you will receive the notification that everyone else gets.
That shows you what it is like and proves it is working.

I could never have not used a spam prevention MOD as within a day or so I would have had 100's if not 1000's of spam posts.

I do like your idea of finding out which e mail accounts are no longer active though as there is no point in having these people as members - they wont be coming back!

My biggest issue is people who register and never make a post (I delete their accounts after 28 days) This Mod is useful for sending out a reminder.
And people who post, asking for specific help which I always give and then never return to see it let alone say thank you!
Title: Re: email Inactive Users
Post by: Miker1029 on August 07, 2015, 09:59:26 AM
Quote from: Topman on August 07, 2015, 02:59:11 AM
For a start set up a member account for yourself (with no posts) and you will receive the notification that everyone else gets.
That shows you what it is like and proves it is working.

I could never have not used a spam prevention MOD as within a day or so I would have had 100's if not 1000's of spam posts.

I do like your idea of finding out which e mail accounts are no longer active though as there is no point in having these people as members - they wont be coming back!

My biggest issue is people who register and never make a post (I delete their accounts after 28 days) This Mod is useful for sending out a reminder.
And people who post, asking for specific help which I always give and then never return to see it let alone say thank you!

Ya the SPAM thing I learned A LONG TIME AGO, I just mentioned it above, NOW I (and for awhile now) have had Absolutely 0 SPAM, Matter of Fact I'm thinking of starting a test trial of 0 on post approval, maybe getting over confident...

Right now I have the Picture Capture, and 1 Post Approval (with Captcha), then your free to "roam".

And Unfortunately the way my forum is setup the Downloads are the draw as I try and Build useful content so "NON" contributors is a give-in.

I've only been on a PAID site going on 6 Months,Almost a year ON FREE SITE (Get chills thinking about those days, but good learning experience, I GUESS).

And I don't have it set-up to E-mail for Non posts, I just want it to go in and E-Mail those who haven't logged in, in 173 days, and the 7 day grace period till deletion...

The Idea's here is to TRY and Get the forum as SELF running as possible...At the Moment I have the E-Mail BLOCK, This MOD (with Auto-Delete Hopefully), the "NO-REPLY Email MOD",  It's not that I want it to RUN COMPLETELY ON IT'S OWN, But Things Like SPAM Posts, OLD USERS, And Other little things like that I'd like just done....

You never mentioned, and I ask so maybe the DEV will consider adding it.  What do you the Of the AUTO-DELETE on ALL CRITERIA Being Met?

Mike
Title: Re: email Inactive Users
Post by: Miker1029 on August 19, 2015, 03:49:18 PM
Hey,

Not sure if this is the MOD causing this issue, But this morning I did approve 3 users for deletion, And I've Disabled (not uninstalled), the mod a couple of hours ago and I'm still getting this, ALL e-mail mods I have are currently disabled, and the "3" user thing seems to be this mod, my Host doesn't provide an E-mail From/To trace so I can't figure where this is coming from, I woke up to 1500 Of these errors, and just deleted them 20 Minutes ago....

HELP?!?!?!  (See Attachments)

And yes I've already Cleared the  Mail Que 1x and it seems to be trying to Resend even after I disabled the MOD, Maybe an SMF thing, I went into Mail Settings and Didn't see a way to "clear" a RESEND?!?!?  If that is what it's trying to do....

Mike
Title: Re: email Inactive Users
Post by: Miker1029 on August 27, 2015, 02:26:48 PM
Still Having the Above Issue....

And just started to have another one, Just wondering if I'm doing something wrong...

I have it set to check for Log-Ins Older then 173 days, Do the E-Mail, Then they have a 7 Day Grace Period, total 180/6 months...

I have it setup in tasks to run at 5am every morning, and the MOD is Active, and the Groups set... And user posts that are 1+ are ignored...

But I have users that are 181 Days old, And a Ran the Task manually and they're not showing in the user list....

I've attached Screen shots....If you have any ideas....

Oh, Also I set the days to 160 and it brought up 1 user for deletion who was 180+ days old.....

Mike
Title: Re: email Inactive Users
Post by: Suki on August 27, 2015, 03:43:08 PM
SMF's scheduled tasks aren't real cronjobs so if your forum isn't every active at 5am chances are the scheduled task was missed and when it was executed, some users didn't meet the criteria. Better set the scheduled task to a more active time.

If you are running the task manually and still no users appear then you need to figure it out which criteria they do not meet.

Its been a while since I look at the code for this mod, it seems a lot of users are getting issues with it and I honestly don't have the energy nor the desire/motivation to work on it any longer, too much trouble for little to no reward.
Title: Re: email Inactive Users
Post by: Miker1029 on August 27, 2015, 04:36:42 PM
Ya I've done manually even set it to 10 days, uninstalled reinstalled still nothing....

I did redo some user permissions yesterday thinking that might be it...

Csn you tell me all the db entries?  Or does the remove data on uninstall handle them all?

Thinking uninstall and remove all settings associated with the mod and reinstall.

And I can give you my thanks for the mod. It is useful..

Mike
Title: Re: email Inactive Users
Post by: Suki on August 28, 2015, 10:24:53 AM
Reinstalling it won't do anything, perhaps the only thing it will do is having duplicate code on your forum which will create yet more issues.

Read this topic, I already explained what the criteria is and even posted a few scripts to help debugging.


As for mails and the mail queue, once this mod calls SMF's sendmail() function the mod cannot do anything beyond that, once again, reinstalling it won't do anything. The mails this mod sent are already on SMFs mail queue so uninstalling the mod won't change that.

This mod cannot possible know if an user's mail is indeed a valid one, it just checks that the user has an email address.
Title: Re: email Inactive Users
Post by: Miker1029 on May 29, 2016, 08:23:52 PM
Hey all,

    We were talking about this earlier, and figured I'd post here for folks still using the mod...

I've changed the delete dates from 6 months/0 posts, to 1 year 50 posts, and thought, HELL, without a Check all option that's gonna hurt....

SOOO I went searching, and since I stink at coding I found a Javascript that will do the job, and I made a Bookmarklet out of it....

SO Basically Create a Bookmark by Hand... call it what you want, Mines CMT (Check Mark Toggle)

Paste this code in the Link and Viola, Check mark toggle for any page you go to....

javascript:(function(){
function checkFrames(w) {

  try {
    var inputs = w.document.getElementsByTagName('input');
    for (var i = 0; i < inputs.length; i++) {
      if (inputs[i].type && inputs[i].type == 'checkbox'){
        inputs[i].checked = !inputs[i].checked;
      }
    }
  } catch (e){}
  if(w.frames && w.frames.length>0){
   
    for(var i = 0; i < w.frames.length;i++){
      var fr = w.frames[i];
      checkFrames(fr);
    }
  }
}
checkFrames(window);
})()


I closed the link to the source, so I can't post it, but this was by no means created bv me, The Implementation Was, But that's cause I couldn't make a code call work.... And Actually I kind of like this better....

Hope It helps someone, as this could be used in MANY situations.....

Mike
Title: Re: email Inactive Users
Post by: aegersz on August 05, 2016, 06:41:21 AM
ignore me as i didn't check all the appropriate membergroups and now it's working fine !

Title: Re: email Inactive Users
Post by: Miker1029 on August 05, 2016, 07:46:38 PM
Should I not waste my time posting Fake E-Mail Texts here?

Mike
Title: Re: email Inactive Users
Post by: Suki on August 06, 2016, 08:57:10 AM
Thats up to you, no time is wasted unless you decide to mark it as such.

Having said that, I cannot think of a reason for posting fake email texts or rather, what would be the purpose of doing so.  This mod is not a spamming oriented mod and shouldn't be used to prevent/control spam.
Title: Re: email Inactive Users
Post by: Miker1029 on August 06, 2016, 09:35:36 AM
Oh Damn, Sorry, I posted on the wrong thread!!!!!!!!!

I thought this was "e-mail username", and I've been working on trying to keep up with the 1000's of fake address for that mod, and uploading them, then I came here and they're GONE!!! Imagine my surprise!!!  LOL

Explains why they are gone!

Mike
Title: Re: email Inactive Users
Post by: elexx on August 25, 2016, 04:39:40 AM
Hello, thank you for this mod!

It works on SMF 2.0.11 but with a little Problem:

The {last_login} variable would not be replaced correctly - the place ist empty.

My custom Mail body is like follows:
QuoteHallo {user_name},
Du warst schon lange nicht mehr im Forum aktiv (zuletzt am {last_login} ).

Klick: {forum_url}

Viele Grüße ..

The replacement of {user_name} and {forum_url} works. I've looked in the ScheduledTasks.php an found the code for replacement:

// Lets create the message. Replace our wildcards with the actual data.
$replacements = array(
'{user_name}' => $row['real_name'],
'{display_name}' => $row['member_name'],
'{last_login}' => timeformat($row['last_login']),
'{forum_name}' => $mbname,
'{forum_url}' => $scripturl,
);


I think, timeformat() returns with an empty string, but why?

Does anybody use this variable, (it's not used in the default message)?
Title: Re: email Inactive Users
Post by: Suki on August 25, 2016, 11:13:38 AM
I believe the last_login row will never be filled for accounts that register but never ever come back again.

A quick fix for those cases would be:

<?php

$request $smcFunc['db_query']('''
SELECT id_member, email_address, inactive_mail, member_name, real_name, last_login, date_registered
FROM {db_prefix}members
WHERE inactive_mail = 0
AND posts <= {int:postLimit}
AND last_login < {int:inactiveFor}
AND date_registered < {int:inactiveFor}
AND is_activated = 1
AND to_delete = 0
AND email_address is NOT NULL
AND (id_group IN ({array_int:groups})
OR id_post_group IN ({array_int:groups})
'
. (implode(' '$additionalgroups)). ')',
array(
'inactiveFor' => $today $inactiveFor,
'groups' => $inGroups,
'postLimit' => $postLimit,
)
);
$messages = array();
while($row $smcFunc['db_fetch_assoc']($request))
{
// Lets create the message. Replace our wildcards with the actual data.
$replacements = array(
'{user_name}' => $row['real_name'],
'{display_name}' => $row['member_name'],
'{last_login}' => timeformat(!empty($row['last_login']) ? $row['last_login'] : $row['date_registered']),
'{forum_name}' => $mbname,
'{forum_url}' => $scripturl,
);
Title: Re: email Inactive Users
Post by: Tones on October 02, 2016, 10:06:13 AM
What I'd like to do is not just send a mail to the member but also one to the webmaster so there's a record one was sent. I'm just unsure how to do this.


$messages[$row['id_member']] = array(
'message' => str_replace($find, $replace, $customMessage),
'mail' => $row['email_address'],
'subject' => str_replace($find, $replace, $customSubject),
);


I'm assuming the mail line needs to be an array though without hardcoding in an email address i don't know how to place the webmaster email in there.

'mail' => array($row['email_address'], $modSettings['webmaster_email']),


Am i even close and would that be the variable to use for the forums email address?
Title: Re: email Inactive Users
Post by: SMiFFER on October 13, 2016, 04:26:27 PM
Nice mod.

Question:
Could you include a function to remind/auto-purge members that have not posted since x days ?
Title: Re: email Inactive Users
Post by: blunted on October 21, 2016, 10:35:08 AM
Every time I select groups, hit save, none are selected at options.
Is this normal?
Title: Re: email Inactive Users
Post by: Suki on October 24, 2016, 12:49:53 PM
No, is there any error on your error log?   what SMF version are you using?
Title: Re: email Inactive Users
Post by: CrescentEclipse on October 26, 2016, 04:19:18 AM
Hello Suki :)

I have some questions about your mod.
First of all, the mod works like intended on SMF 2.0.12. No problems at all. Great mod, thank you for your effort! :D

Is it possible to easily disable the minimum post count?
I think it is a bit redundant when you have post count based membergoups, which are very common.
On the other hand it could be handy if you could set a different behavior for users with a higher post count.
(no deletion, only inform)

The next thing is, and many people here seem to have the same opinion, it is confusing to only see the users marked for possible deletion after the grace period expired. Is it possible to somehow enhance the user list by showing some categories?

Maybe something like this:

1. A list with informed users
2. A list with users marked for possible deletion
3. A list with users who will be deleted on next task run
4. A list with users who are protected (maybe with a reset button?)

I think this will give you a nice overview what is currently going on. This is only an idea.
It would be great to have such features, to give this mod a perfect finishing.

Some additional information:
Hm, I found a text variable, which is not used in the mod: $txt['eiu_list_will_be_deleted'] (planned feature, like it suggested?)
$txt['eiu_list_title_potential'] and $txt['eiu_list_title'] are used for the user list (in the menu and in the list itself). Maybe one should be enough?

If you are interested, I can provide a german translation as well ;)

Thank you again for this nice mod. It is a mystery that this is not a standard feature of SMF.

lg Cres
Title: Re: email Inactive Users
Post by: Suki on October 27, 2016, 10:12:34 AM
Yeah, those are nice features and are doable, unfortunately, I do not have the time to implement them.
Title: Re: email Inactive Users
Post by: SMiFFER on October 30, 2016, 07:33:17 AM
Quote from: Marceline on October 27, 2016, 10:12:34 AM
Yeah, those are nice features and are doable, unfortunately, I do not have the time to implement them.
What if we share that work then?
Title: Re: email Inactive Users
Post by: Suki on October 31, 2016, 01:33:56 PM
The mod has always been open source (https://github.com/MissAllSunday/emailInactiveUsers)
Title: Re: email Inactive Users
Post by: Paracelsus on November 11, 2016, 10:46:22 AM
Hi Suki,

Quick question, how do I "reset" the list of inactive users that have already received the email? I use this MOD not to dele the users but as a reminder to visit the forum. Since last time most of them got the email was ages ago, I wanted to send them once more.
Title: Re: email Inactive Users
Post by: aegersz on November 12, 2016, 03:01:40 AM
Just increase (backdate) your time limit to catch them again, that's my guess.
Title: Re: email Inactive Users
Post by: romanos8 on November 28, 2016, 07:57:58 PM
Can you tell me the name of the tables in database ? because I am getting the following  error:

Duplicate entry 'emailInactiveUsers' for key 'task'


Maybe I had installed the same mode.
Title: Re: email Inactive Users
Post by: Shambles on November 29, 2016, 03:53:14 AM
You can find the database entries by looking at the install.php file, which is included as part of the supplied modification.

It may confirm what you suspect.
Title: Re: email Inactive Users
Post by: romanos8 on December 01, 2016, 11:23:43 AM
Thanks, mow I have a new problem. How can I remove all the old users marked for deletion?

Quote from: Shambles on November 29, 2016, 03:53:14 AM
You can find the database entries by looking at the install.php file, which is included as part of the supplied modification.

It may confirm what you suspect.
Title: Re: email Inactive Users
Post by: OtterlyAdorable on May 15, 2017, 11:01:44 AM
This mod is exactly what I'm looking for for my board, but it doesn't work on the most recent version of SMF.  Are there any plans for updating it?
Title: Re: email Inactive Users
Post by: Arantor on May 15, 2017, 11:18:22 AM
How can I install a mod that doesn't work in my SMF version? (http://wiki.simplemachines.org/smf/How_can_I_install_a_mod_that_doesn%27t_work_in_my_SMF_version)
Title: Re: email Inactive Users
Post by: OtterlyAdorable on May 16, 2017, 12:46:16 PM
Quote from: Arantor on May 15, 2017, 11:18:22 AMHow can I install a mod that doesn't work in my SMF version? (http://wiki.simplemachines.org/smf/How_can_I_install_a_mod_that_doesn%27t_work_in_my_SMF_version)

..... My apologies.  Not only have I read this before when I was researching it, but I totally missed this line:

Note: While emulation is active, you might see a news item at the top of the page stating that a new version of SMF is available. You can disregard this. Only pay attention to such news items when version emulation is not activated.
Title: Re: email Inactive Users
Post by: akbora on May 16, 2017, 02:34:55 PM
Quote from: OtterlyAdorable on May 15, 2017, 11:01:44 AM
This mod is exactly what I'm looking for for my board, but it doesn't work on the most recent version of SMF.  Are there any plans for updating it?

https://custom.simplemachines.org/mods/index.php?mod=4086

This mod can help you if I am not mistaken
Title: Re: email Inactive Users
Post by: OtterlyAdorable on July 17, 2017, 03:05:57 PM
Quote from: akbora on May 16, 2017, 02:34:55 PM
https://custom.simplemachines.org/mods/index.php?mod=4086
This mod can help you if I am not mistaken

Oh this looks great, thank you!!
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 08:07:13 AM
Hi,

I would very much like to use this mod, but every time I try, I just can't set the groups? I get this error message

2: in_array() expects parameter 2 to be array, boolean given File:
/home/lrdvgak/public_html/smf/Themes/default/Admin.template.php
Line: 909

I have tried uninstalling and and reinstalling, but always the same.

Any help please?

Thanks
Pete
Title: Re: email Inactive Users
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 08:36:30 AM
See the discussion here https://www.simplemachines.org/community/index.php?topic=521464.msg3730753#msg3730753
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 08:50:26 AM
Ok. I think I understand by this that it is an SMF bug, and once a group has been selected from the drop down menu and saved, it should go away?
This doesn't seem to be the case for me? It doesn't seem to be selecting a group at all? Also, do I click on each group and save individually to add more than one group? Where should I be able to see the groups selected?
Thanks for your help
Title: Re: email Inactive Users
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 09:05:19 AM
From what I remember, from my own tests, you will need to select all groups at one go and save. And if I remember correctly, it works as expected even though it doesn't seem like it.
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 09:18:56 AM
The only way to do that would be to highlight them, then save. Is that right? And if it has worked, surely I would have an email queue, as I have 500 odd members that would be sent the email?
Title: Re: email Inactive Users
Post by: Aleksi "Lex" Kilpinen on January 25, 2018, 09:22:43 AM
Yeah, I don't have this installed at the moment but I think it was just a case of ctrl+click selecting the groups, and saving.

About the queue, the mod runs on a schedule - you can see it in Admin -> Maintenance -> Scheduled tasks as "emailInactiveUsers" if I remember correctly.
Title: Re: email Inactive Users
Post by: Suki on January 25, 2018, 10:56:59 AM
That particular bug got fixed in a minor SMF release, can't remember the exact number, what version are you using?

As for the mail queue, this mod uses SMF's one, the amount of emails this mod will produce will be added to your current mail queue. You gotta be careful while tunning this mod, depending on your settings you can end up with a bunch of members ready to be deleted or none. It also doesn't automatically delete members, you need to approve their deletion first.
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 11:13:19 AM
Hi Suki,
Great mod, and I'm very keen to get it working. I'm running SMF 2.0.15 and the standard on board SMF mail queue.
Curiously, when I uninstalled and deleted the mod, then reinstalled froma fresh upload, my original setting were still in place??
Title: Re: email Inactive Users
Post by: Suki on January 25, 2018, 11:24:37 AM
Whats the exact line you got in your admin.template file?

Should look something like this one:

                                 <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';


Yes, the settings will still be there, I rarely offer an option to delete them unless I build my own tables.
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 11:37:19 AM
Quote from: Suki on January 25, 2018, 11:24:37 AM
Whats the exact line you got in your admin.template file?

Should look something like this one:

                                 <option value="', $option[0], '"', (!empty($config_var['value']) && ($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected' : ''), '>', $option[1], '</option>';




Sorry, where would I find this?
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 01:00:09 PM
Ok found it.
Reads

<option value="', $option[0], '"', (($option[0] == $config_var['value'] || (!empty($config_var['multiple']) && in_array($option[0], $config_var['value']))) ? ' selected="selected"' : ''), '>', $option[1], '</option>';
Title: Re: email Inactive Users
Post by: petewadey on January 25, 2018, 05:30:32 PM
Also, I notice my mail queue is backing up and shows page not found when I try to send. If i uninstall this mod, the post goes ok??
Title: Re: email Inactive Users
Post by: Suki on January 26, 2018, 10:46:30 AM
Is there an error in your error log?
Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 11:13:31 AM
Just ones like this. All Line 909

http://bsac10c11c12.co.uk/smf/index.php?pretty;action=admin&amp;area=eiu;sa=generalApply : in_array() expects parameter 2 to be array, boolean givenApply  /home/lrdvgak/public_html/smf/Themes/default/Admin.template.php
Line: 909
Title: Re: email Inactive Users
Post by: Suki on January 26, 2018, 12:07:43 PM
OK, what do you exactly mean by "backing up" and "page not found"?
Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 12:15:07 PM
When the mod is installed, if I go to my email queue, I see emails there that have been waiting to be sent, just a couple, and not related to the mod. When I try to send the emails, I get page not found message. If I uninstall the mod, then go to email queue, the queue is empty. So the emails sent as they should, but wouldn't with the mod installed.
Same thing with scheduled tasks. When I try to run any task with mod installed I get the same page not found message. Uninstall the mod and tasks will run as normal?
Thanks for help
Title: Re: email Inactive Users
Post by: Suki on January 26, 2018, 12:19:04 PM
Can you show me a screenshot of that "page not found" error
Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 12:27:14 PM
Not done this before. Hope it works
Title: Re: email Inactive Users
Post by: Suki on January 26, 2018, 12:41:44 PM
I mean an actual image of your screen, you can use the "PrntScr" key to create it and then use some image manipulation program to save the image
Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 12:53:04 PM
Ok. Thanks
Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 12:59:10 PM
and Mail queue
Title: Re: email Inactive Users
Post by: Suki on January 26, 2018, 01:00:18 PM
and are you sure there isn't any error related to that page in your error log?  the only thing I can think of is the mod missing some files and your host been configured to fire a 500 error if there is a PHP error, that also might explain why SMF doesn't catch it.

Follow the mod's manual instructions: https://custom.simplemachines.org/mods/index.php?action=parse;mod=3849;attach=239036;smf_version=2.0.15

And be sure you have all the files this mod adds in their correct locations. Also, if you have access to your error log (your hosting error log, NOT SMF's) take a look at it and see if theres any error related to that page.

Title: Re: email Inactive Users
Post by: petewadey on January 26, 2018, 01:04:58 PM
Thanks for your help. I have to go out now, but will be straight on it tomorrow.
Title: Re: email Inactive Users
Post by: petewadey on January 27, 2018, 07:57:43 AM
I have 2 ./Sources/ScheduledTasks.php files, applications/x-httpd-php and text/x generic. Both have seem to have the same content. Which one should I edit? (I will make a copy before I touch it)
Also, should I uninstall the mod and delete it before doing a manual install, or just replace the existing script?
Thanks for your patience. I am keen to learn
Title: Re: email Inactive Users
Post by: petewadey on January 27, 2018, 09:47:13 AM
I don't know if the attached is of any help, but scroll down and there seems to be more script than there is in the manual install script?
Title: Re: email Inactive Users
Post by: petewadey on January 29, 2018, 01:14:35 PM
Anyone??
Title: Re: email Inactive Users
Post by: Suki on January 30, 2018, 10:58:27 AM
That file looks OK at first glance. Did you had the chance to look at your hosting error log?
Title: Re: email Inactive Users
Post by: petewadey on January 30, 2018, 11:43:35 AM
I asked my host to and they couldn't find anything?
Title: Re: email Inactive Users
Post by: Suki on January 30, 2018, 01:46:28 PM
Did they know what to look for?

Are you able to grab a copy of those logs?

Did you make sure that all files this mod uses are placed in their correct locations?, besides the change on the file you attached, there are several files that need to be placed in their correct locations.
Title: Re: email Inactive Users
Post by: petewadey on February 03, 2018, 12:39:11 PM
I've asked for a copy of the error logs and they replied
"Please let us know how we can reproduce the error exactly step by step, the URLs involved and the access credentials if necessary."
What should they be looking for?
Thanks
Title: Re: email Inactive Users
Post by: Suki on February 03, 2018, 03:30:24 PM
In all honestly,it will be easier if you just go look and see if all the files this mod uses are properly placed in their correct location, you just need to follow the mod's parser. There is a wiki page on how to use it.

If you don't want to do that,then ask for a copy of your error log and send me a link to it over pm.
Title: Re: email Inactive Users
Post by: petewadey on February 03, 2018, 03:34:42 PM
I'm on the case with my host. Will take your advise if they can't help.
Thanks for your patience
Pete
Title: Re: email Inactive Users
Post by: petewadey on February 05, 2018, 08:22:08 AM
Ok, Looks like I'm going to check/ replace files using the mod's parser.
Questions
Should I uninstall and delete mod, then reinstall manually or work with what is already in the files?
Is it ok to use this program to do so https://www.smfhacks.com/smf-package-parser.html (https://www.smfhacks.com/smf-package-parser.html)
Thanks
Title: Re: email Inactive Users
Post by: Suki 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.
Title: Re: email Inactive Users
Post by: petewadey 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
Title: Re: email Inactive Users
Post by: aegersz 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 ?

Title: Re: email Inactive Users
Post by: Suki 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
Title: Re: email Inactive Users
Post by: aegersz 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 !
Title: Re: email Inactive Users
Post by: @rjen 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...
Title: Re: email Inactive Users
Post by: Suki 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.
Title: Re: email Inactive Users
Post by: @rjen 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...
Title: Re: email Inactive Users
Post by: aegersz 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:

<?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();
?>

Title: Re: email Inactive Users
Post by: aegersz 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 (https://www.simplemachines.org/community/index.php?topic=562109.msg3987610#msg3987610)
Title: Re: email Inactive Users
Post by: Sir Osis of Liver 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
Title: Re: email Inactive Users
Post by: Suki on December 22, 2018, 02:10:48 PM
What SMF version are you using? I recall there was a bug with adding a select option, upgrade to the latest available SMF version or just set an option and save.
Title: Re: email Inactive Users
Post by: SMiFFER on December 19, 2019, 07:00:37 PM

3 years later, how about now?  :laugh:

Quote from: SMiFFER on October 13, 2016, 04:26:27 PM
Nice mod.

Question:
Could you include a function to remind/auto-purge members that have not posted since x days ?
Title: Re: email Inactive Users
Post by: Suki on December 20, 2019, 10:20:21 AM
Fair enough :P
Title: Re: email Inactive Users
Post by: acmirapt on December 20, 2019, 12:30:40 PM
I've downloaded this plugin in Monday, and i've been planning to run it to clean a User Database with lots of users since 2005  :-X

But i have a question. This will delete only users or users and his posts and content? Or it will put the users replys and topics as Visitor state?

Thanks!  8)
Title: Re: email Inactive Users
Post by: Suki on December 21, 2019, 09:34:22 AM
Hi, welcome to SMF.

This mod follows SMF's deletion process (as of SMF 2.0.15), meaning their posts won't be deleted but marked as "guest post" or visitor state as you call it.
Title: Re: email Inactive Users
Post by: acmirapt on December 21, 2019, 06:07:57 PM
I've all the settings done, the emails are sent yesterday at 1AM.

Now, in the plugin Users List i dont have any List. It only says
"There aren't any users marked for potential deletion"

Why this happen? I've checked the DB and smf_members table and there are some users with 1 in user deletion column.

Can you help? Its possible to do List and delete in another Way?? I dont want to send another email to users, because some of them Will report that as spam and other mais are returned (maybe there's no email account anymore)

Thanks for your help.
Title: Re: email Inactive Users
Post by: Suki on December 22, 2019, 11:03:56 AM
The mod does the deletion in two steps, first it sends an email to those users that hasn't been logged since X days, then some more time passes, the "grace period" where users can indeed log in and they will no longer be counted for deletion.

Only those users who who received the mail and still hasn't logged in will be counted towards deletion.
Title: Re: email Inactive Users
Post by: acmirapt on December 23, 2019, 04:43:14 AM
Thanks for your help Suki. So after the grace period that i've selected in the settings the users to listed for deletion / inactive will appear in the list.

Thanks again!  8)
Title: Re: email Inactive Users
Post by: Chas Large on February 18, 2021, 07:08:51 AM
Hi Suki,

Hope you are well.

I have 210 members who have never posted since they signed up over a year ago and I want to try and either encourage them back into using the forum or delete them.

Have just installed this mod and like others before, am having a few issues.

Running SMF 2.0.18. Installed OK, set the settings to:

How many days since their last log in to receive the email. = 365
How many days since the user was marked for deletion = 15
Minimum posts made = 0

Run the mod and get the "There aren't any users that match the criteria" message in the list.

Created the test PHP file you give here: https://www.simplemachines.org/community/index.php?topic=521464.msg3808007#msg3808007

with the same result.

Change the How many days since their last log in to receive the email. to 300 and I get 13 results with the test file.

Reducing this number again gives more results.

I'm wondering if I have misunderstood the "How many days since their last log in to receive the email" setting? An Admin search uses the date of the last login to give my list based on zero posts, does your mod do the same or has it got a limit in the number of days you can enter here?

I can get the most numbers in the test by entering 0 days but this only results in 47 members potentially being targeted.
Title: Re: email Inactive Users
Post by: Suki on February 18, 2021, 09:30:09 AM
This is the query used to select which users will get an email:


SELECT id_member, email_address, inactive_mail, member_name, real_name, last_login
FROM {db_prefix}members
WHERE inactive_mail = 0
AND posts <= {int:postLimit}
AND last_login < {int:inactiveFor}
AND date_registered < {int:inactiveFor}
AND is_activated = 1
AND to_delete = 0
AND email_address is NOT NULL
AND (id_group IN ({array_int:groups})
OR id_post_group IN ({array_int:groups})
'. (implode(' ', $additionalgroups)). ')',


It is build with several conditionals to prevent false positives or otherwise accidental mass deletion.

The user must meet all these requirements before been eligible for email and deletion.  As you can see, there are important checks such as post limit, the user has to have an email and it must belong to a specific group you select on the mod's admin settings. The user also needs to be active and not marked as received an email previously.

You can use the script provided to test out which validation is preventing from getting the results you expect.
Title: Re: email Inactive Users
Post by: Sir Osis of Liver on June 06, 2021, 07:00:01 PM
Was playing with this mod 5 days ago to see how it works.  Settings are:

- Disable deletion of users - checked
- Days since last login - 1
- Days since user marked for deletion - 0
- Minimum posts - 0

We don't want to delete members.  Created test user, 1 post, last online 5 days ago.  Today received email.  Not seeing how settings are applied.

Title: Re: email Inactive Users
Post by: Ninja ZX-10RR on June 10, 2021, 05:37:37 PM
That seems to have worked as intended then? ???
Title: Re: email Inactive Users
Post by: Sir Osis of Liver on June 10, 2021, 05:51:55 PM
Dunno, would think if days since last login is 1, should send email every day.  Got one after 5 days, waiting to see if another is sent after 10 days (tomorrow).  Don't think the mod reports emails sent, so there's no way to know if it's actually working.
Title: Re: email Inactive Users
Post by: Suki on June 18, 2021, 11:24:25 AM
The mod uses scheduled tasks whoch are only triggered when someone hits the forum, if there is no traffic then no scheduled tasks are triggered and therefore no actions were taken by the mod. Also, the user must meet all the criterias on my previous post for an email to be sent.
Title: Re: email Inactive Users
Post by: SMiFFER on June 26, 2021, 11:19:17 AM
Quote from: Suki on February 18, 2021, 09:30:09 AM
This is the query used to select which users will get an email:

Thanks!
How would I get the date of the last post that user has made?
Title: Re: email Inactive Users
Post by: SpacePhoenix on June 26, 2021, 11:59:33 PM
Never tried this mod myself. One thing you could perhaps add to it if it's not already a part of it, is to have it parse any bounced back emails for the reason why they were bounced back and act on the reason given. For example if it come back as the destination email doesn't exist, then you might want to delete that user (or at least change the user name to something like "Deleted User #" where # is just a unique number to keep from having two identical user names in the DB).

The user email address could perhaps be changed to deleteduser#@made_up_site_name.com where # is the same number. You could perhaps try and mod SMF so that anytime an email is being sent and the email address is for a deleted user, have SMF give an error and not send the email
Title: Re: email Inactive Users
Post by: Nirose on July 06, 2021, 09:56:38 PM
Hi,

Thank you for this mod. it works good but as I set the send-email duration to a slower rate (to prevent being considered spam), it creates duplicate email queue for same users multiple times.

Is there any way to prevent this?
Title: Re: email Inactive Users
Post by: Shades. on March 25, 2022, 10:26:56 PM
Hey @Suki any chance to update this for 2.1.1? O:)
Title: Re: email Inactive Users
Post by: Shades. on March 25, 2022, 11:45:48 PM
Quote from: Shades. on March 25, 2022, 10:26:56 PMHey @Suki any chance to update this for 2.1.1? O:)
Actually I just installed this on a fresh 2.1.1 with a clean database but it won't install on my live site.

I know this only supported for 2.0.9 but maybe someone can tell me what to do with this error...

After clicking the 2nd install in package manager I get:

QuoteData truncated for column 'inactive_mail' at row 2
File: /home2/*****/public_html/*****/Packages/temp/install.php
Line: 38

Edited to say: I figured it out! ;)

Had to delete these old columns in smf_members from when my forum was 2.0.19 and then it installed.

inactive_mail
sent_mail
to_delete
Title: Re: email Inactive Users
Post by: lagunaclubnl on April 04, 2022, 07:00:24 AM
files are on right position, dbase valeus are ok still got this error:

De callable eiu_modifications kon niet aangeroepen worden. and
Hook-aanroep: functie "eiu_modifications" in bestand /home/xxxxxxxxxxx/domains/lagunaclub.nl/private_html/forum kon niet worden aangeroepen.

Called from:
xxxxs://www.lagunaclub.nl/forum/index.php?action=admin;area=modsettings;sa=realpopup;xxxxxx=xxxxxxx


I am using SMF2.1.1, Tinyportal and realpopup.
Title: Re: email Inactive Users
Post by: Doug Heffernan on April 04, 2022, 07:07:15 AM
Quote from: lagunaclubnl on April 04, 2022, 07:00:24 AMfiles are on right position, dbase valeus are ok still got this error:

De callable eiu_modifications kon niet aangeroepen worden. and
Hook-aanroep: functie "eiu_modifications" in bestand /home/xxxxxxxxxxx/domains/lagunaclub.nl/private_html/forum kon niet worden aangeroepen.

Called from:
xxxxs://www.lagunaclub.nl/forum/index.php?action=admin;area=modsettings;sa=realpopup;xxxxxx=xxxxxxx


I am using SMF2.1.1, Tinyportal and realpopup.

This mod is not compatible with smf 2.1.x.
Title: Re: email Inactive Users
Post by: Dave J on June 03, 2023, 10:09:16 AM
Quote from: Shades. on March 25, 2022, 11:45:48 PM
Quote from: Shades. on March 25, 2022, 10:26:56 PMHey @Suki any chance to update this for 2.1.1? O:)
Actually I just installed this on a fresh 2.1.1 with a clean database but it won't install on my live site.

I know this only supported for 2.0.9 but maybe someone can tell me what to do with this error...

After clicking the 2nd install in package manager I get:

QuoteData truncated for column 'inactive_mail' at row 2
File: /home2/*****/public_html/*****/Packages/temp/install.php
Line: 38

Edited to say: I figured it out! ;)

Had to delete these old columns in smf_members from when my forum was 2.0.19 and then it installed.

inactive_mail
sent_mail
to_delete


@shades,

Did you get this to actually send emails?

I have installed it on 2.1.3 with no errors, I can setup the settings and it says it's sent an email in the log but it doesn't actually send one. I get an error

8: unserialize(): Error at offset 0 of 25 bytes
This is the url causing the issues apparently.

URL of page causing the error
https://********/*******/index.php?action=calendar;viewlist;year=2021;month=8;day=7
Title: Re: email Inactive Users
Post by: Shades. on June 03, 2023, 10:28:06 AM
Quote from: Dave J on June 03, 2023, 10:09:16 AMDid you get this to actually send emails?
I believe I did on 2.1.1 but I don't have it installed anymore, using 2.1.3 now and I don't remember why I uninstalled it because it's been a while lol! But more than likely it was throwing errors and couldn't get to work right on 2.1.3 or I wouldn't have uninstalled it. ;)  ???
 
Title: Re: email Inactive Users
Post by: Dave J on June 03, 2023, 10:39:18 AM
Quote from: Shades. on June 03, 2023, 10:28:06 AM
Quote from: Dave J on June 03, 2023, 10:09:16 AMDid you get this to actually send emails?
I believe I did on 2.1.1 but I don't have it installed anymore, using 2.1.3 now and I don't remember why I uninstalled it because it's been a while lol! But more than likely it was throwing errors and couldn't get to work right on 2.1.3 or I wouldn't have uninstalled it. ;)  ???
 

OK thanks for the quick reply Shades much appreciated.

I really could do with a mod like this
Title: Re: email Inactive Users
Post by: Suki on June 22, 2023, 12:45:18 PM
Mod has been updated:

v1.2 support for SMF 2.1.x

No new features were added, just support for 2.1

https://github.com/MissAllSunday/emailInactiveUsers/releases/tag/v1.2

Please report any issues with this new version, will try to address them as time allows it.
Title: Re: email Inactive Users
Post by: Dave J on June 22, 2023, 02:00:01 PM
Thank you Suki
Title: Re: email Inactive Users
Post by: Dave J on June 25, 2023, 03:15:49 AM
Suki,

There is an issue. For some reason the 'integrate_modify_modifications' hook is not installing.

This is on a clean install, no other mods installed on 2.1.4 running PHP7.4
Title: Re: email Inactive Users
Post by: Suki on June 25, 2023, 02:34:19 PM
Seems its a leftover, weird I didn't catch it while testing. You can safely remove the string "eiu_modifications" from table smf_settings row integrate_modify_modifications.

I'm going to wait a little more before I make a new release in case there are other issues.

Title: Re: email Inactive Users
Post by: Dave J on June 26, 2023, 01:01:21 AM
Quote from: Suki on June 25, 2023, 02:34:19 PMSeems its a leftover, weird I didn't catch it while testing. You can safely remove the string "eiu_modifications" from table smf_settings row integrate_modify_modifications.

I'm going to wait a little more before I make a new release in case there are other issues.



Thanks Suki. Removed the integrate_modify_modifications' from hooks.php, reinstalled and seems to be OK. I should have added that the mod did work to send out emails, it was just that error.
Title: Re: email Inactive Users
Post by: landyvlad on July 01, 2023, 05:47:51 AM
Can this be used to send out email but set NOT to delete the inactive users?
Title: Re: email Inactive Users
Post by: Dave J on July 01, 2023, 06:22:36 AM
Quote from: landyvlad on July 01, 2023, 05:47:51 AMCan this be used to send out email but set NOT to delete the inactive users?

Yes. The settings allow for that.
Title: Re: email Inactive Users
Post by: filippo on July 03, 2023, 09:52:21 AM
Hi, every day I find this error

SMF 2.1.4
Title: Re: email Inactive Users
Post by: Suki on July 03, 2023, 01:56:00 PM
Use the correct version of this mod, the one compatible with SMF 2.1, either that or there was an error while upgrading your forum from 2.0 to 2.1. When performing the upgrade, all serialized data is ported to json, including this mod's serialized data.


Title: Re: email Inactive Users
Post by: filippo on July 04, 2023, 07:15:36 AM
I'm using the version suitable for the 2.1.4. And this mod was installed after the update
Title: Re: email Inactive Users
Post by: Suki on July 04, 2023, 12:14:54 PM
Then go to your DB, in the settings table find the row with variable "eiu_groups" and delete all content on its value field.

This query should do the trick, obviously take all the safety measures beforehand:
UPDATE smf_settings
SET value = ''
WHERE variable = 'eiu_groups';

Enter the mod's settings page and re-enter your desired settings, save.
Title: Re: email Inactive Users
Post by: filippo on July 05, 2023, 05:38:20 AM
The errors seem to have disappeared, thanks
Title: Re: email Inactive Users
Post by: Marina3 on November 04, 2023, 01:51:07 AM
Error:
Hook call: function "eiu_modifications" could not be called.
The callable eiu_modifications could not be called.
I use SMF 2.1.4 and php 8.2.
Title: Re: email Inactive Users
Post by: Kindred on November 04, 2023, 07:48:37 PM
I suspect that the mod does not support php 8.2
Title: Re: email Inactive Users
Post by: Suki on December 04, 2023, 02:23:42 PM
Quote from: Marina3 on November 04, 2023, 01:51:07 AMError:
Hook call: function "eiu_modifications" could not be called.
The callable eiu_modifications could not be called.
I use SMF 2.1.4 and php 8.2.

Thats probably related to a bad install rather than PHP support. How do you installed the mod? via packager manager or manually?