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 Mod (http://custom.simplemachines.org/mods/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.
- 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)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FsmE8A02.png&hash=0483982e2d548ec7354ffcce642f48dc)
Title: Re: email Inactive Users
Post by: Suki on April 20, 2014, 08:45:09 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
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
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
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: SaltedW 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
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:
Code: [Select]
<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
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):
Code: [Select]
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
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):
Code: [Select]
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
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
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
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
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
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):
Code: [Select]
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
OK, 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:

Code: [Select]
// 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.

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

Example for message body:
Code: [Select]
Szia kedves {display_name}! öüóőúéáí ÖÜÓŰŐÚÉÁÍ
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:

Code: [Select]
// 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.

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:
Code: [Select]
"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
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

Code: [Select]
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 :)


(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fs27.postimg.org%2F7ast3t8ab%2Fcap_desinstalar_Email_Inactive_User_from_forum_sge.jpg&hash=ce2f76afcd3c8de87d30aa8ec5eae7e6)


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
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
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:

Code: [Select]
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:

Code: [Select]
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:

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):
Code: [Select]
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
No, that bug won't cause any issue with your forum nor it will automatically delete your members...

I'm so relieved, thank you!  :)

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....:

Quote
select 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:
Quote
This 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
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:
Quote
This 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.

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
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:
Quote
This 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.

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
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:
Code: [Select]
// 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:

Code: [Select]
// 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?

   
Code: [Select]
// 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.

Quote
http://.../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:
Code: [Select]
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

Code: [Select]
$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:

Code: [Select]
<?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:

Code: [Select]
<?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
RSI do you have any users marked as ready for deletion?  does your forum sends out mails?

Yes, it sends out emails.

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
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
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:

Code: [Select]
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

Code: [Select]
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
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
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:


Code: [Select]
$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
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:


Code: [Select]
$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
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
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
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
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....

Code: [Select]
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:
Quote
Hallo {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:

Code: [Select]
// 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:

Code: [Select]
<?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.

Code: [Select]
$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.
Code: [Select]
'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
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?

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
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)

..... 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
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
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!!