email Inactive Users

Started by Suki, April 19, 2014, 02:00:47 PM

Previous topic - Next topic

Suki

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.

Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

zarachrome

That's right!
Thank you for explain it  :)

Suki

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

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


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

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



OK, I uploaded the correct package.

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

Anyway, heres the correct branch, if you enable the "Disable the deletion of users feature" option then the user list will always remain empty since the change I introduced will reset the user status back to normal instead of mark the user for deletion.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

mikk

Quote from: Suki on June 10, 2014, 03:10:44 PMOK, I uploaded the correct package.

Hi!

Thanks for this mod,  I'm testing this.

Problems:
- With non-UTF8 language forum, non-ASCII2 chars is lost in subject and in the mail body. But with UTF8 forum all character is OK.
- html code doesn't work in mail body,  example:<b>
- after mod uninstall, "inactive_mail", "sent_mail", and "to_delete" is remain in the database
- after mod uninstall, this mod scheduled task didn't delete.

Suki

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

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

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


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


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

If you want to remove those settings you need to check the "Remove all data associated with this modification"  checkbox when uninstalling.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Arantor

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.

mikk

Hi!

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

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

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

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

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


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


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

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

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

I don't remember to this settings, but now I can't install again the mod, because I get error messages:
"Database error"
Duplicate entry 'emailInactiveUsers' for key 'task'
"File": /var/www/vhosts/xxx.xxx.hu/httpdocs/test/forum-iso/Packages/temp/install.php
"line": 86

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

mikk

Quote from: Suki on June 13, 2014, 11:54:34 AM
Yeah, to be honest, I'm not sure theres something I can do and even if I can, I have way too many things on my head right now, best advice I can give you is use utf8 or just use html entities directly on the subject.
I believe is the last param on sendmail($m['mail'], $m['subject'], $m['message'], null, null, false);  dunno, can't check right now.

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

Anyway, thanks for answers, this mod is very good idea.

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

senyor35

When I install this mod the Scheduled Task file is gives error this line;

function($k) {

What solve please?

Suki

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
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Impsat-1

Ufff!!!... hey Suki, I´m sorry but when uninstalling and re-install the MOD, say this

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


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

I hope for solution...

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

Thanks & Regards.-
Vive Cáda Momento De Tu Vida Como Si Fueras a Irte Mañana, Más Planificala Cómo Si Jamás Fueras a Irte ;).-

Impsat-1

Ufff!!!... Ok Suki, Solved... from db, I delete all tables ;)


Thanks & Regards 8).-
Vive Cáda Momento De Tu Vida Como Si Fueras a Irte Mañana, Más Planificala Cómo Si Jamás Fueras a Irte ;).-

Impsat-1

Mmm... for any user in future, Uninstall like in pic :)




Thanks & Regards, have a great time 8).-
Vive Cáda Momento De Tu Vida Como Si Fueras a Irte Mañana, Más Planificala Cómo Si Jamás Fueras a Irte ;).-

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Impsat-1

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).-
Vive Cáda Momento De Tu Vida Como Si Fueras a Irte Mañana, Más Planificala Cómo Si Jamás Fueras a Irte ;).-

Ninja ZX-10RR

Nice mod and thanks for the update, good new feature :)
Unless
Quote from: Suki on July 14, 2014, 12:34:19 PM
dunno/don't really care.
this is not really cool to say IMHO ;)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Suki

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.
Disclaimer: unless otherwise stated, all my posts are personal and does not represent any views or opinions held by Simple Machines.

Ninja ZX-10RR

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 :)
Quote from: BeastMode topic=525177.msg3720020#msg3720020
It's so powerful that on this post and even in the two PMs you sent me,you still answered my question very quickly and you're apologizing for the delay. You're the #1 support I've probably ever encountered man, so much respect for that. Thank you, and get better soon.

I'll keep this in my siggy for a while just to remind me that someone appreciated what I did while others didn't.

♥ Jess ♥

STOP EDITING MY PROFILE

Advertisement: