Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: vbgamer45 on March 11, 2013, 09:55:35 AM

Title: Force Read Pms
Post by: vbgamer45 on March 11, 2013, 09:55:35 AM
Link to the mod (https://custom.simplemachines.org/index.php?mod=3671)

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fbit.ly%2FkZVDB6&hash=7836fdef4323714489209ed06cd4e4f88c199aea)

[glow=black,2,300]Force Read Pms[/glow]
Developed by 4Kstore (http://www.smfsimple.com/index.php?action=profile;u=55)
For SMFSimple.com (http://www.smfsimple.com/)

SMF 2.0 - 2.0.X



[glow=black,2,300]El soporte oficial de los desarrolladores de nuestros mods lo encontraras en SMFSimple.com
Official Support in www.SmfSimple.com (http://www.smfsimple.com/)
[/glow]



[glow=black,2,300]Description:[/glow]
Force users to read PMs when they have more than X Unread Pms

[glow=black,2,300]Descripcion:[/glow]
Obliga a los usuarios a leer los Mensajes Privdaos cuando tenga mas de X sin leer



[glow=black,2,300]Features:[/glow]
Administration:
Enable - Disable the mod.
Minimum number of unread PMs to redirect
Excludes Groups


[glow=black,2,300]Caracteristicas:[/glow]
Administracion:
Habilitar - Deshabilitar el mod.
Minima cantidad de MP no leidos para redireccionar
Grupos Excluidos



[glow=black,2,300]Screnshoot | Capturas[/glow]
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FPUJq55N.png&hash=4c987d5ada63ffcde4f5f17fe7307760a26b30cc)


Language Support | Lenguajes Soportados
English & Spanish


Settings
Administration Center » Configuration » Modification Settings » Force Read Pms
index.php?action=admin;area=modsettings;sa=forcereadpm
Notes:
This Mod Uses Hooks.

License:
* This SMF modification is subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this SMF modification except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/ (http://www.mozilla.org/MPL/)
Title: Re: Force Read Pms
Post by: Shambles on March 11, 2013, 10:31:19 AM
So simple yet so useful - thanks :)

One question, or possible enhancement: would you consider returning some kind of confirmation message when the configuration has been saved?

In Configuration > Modification Settings > Force Read PMs, currently when you click "save" no indication is given that the changes have been accepted.
Title: Re: Force Read Pms
Post by: Shambles on March 11, 2013, 10:56:56 AM
Doesn't appear to work (I have PM Informer installed). I'll play more when I get home from work to see if there's a conflict.


In the meantime, I'm getting huge quantities of errors.

(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2FW2Gs9sf.jpg&hash=f0d2db3e600af4abb4c2dae8487fff65c5f12ccf)
Title: Re: Force Read Pms
Post by: Arantor on March 11, 2013, 11:06:01 AM
Ah, yes, I see what the problem is.

I really, really, really wish people would stop screwing around testing $user_info['groups'] by index, because as this example proves, $user_info['groups'][1] MAY NOT NECESSARILY EXIST. Guests don't have a post count group! So much bad advice around about this.

I'd suggest line 76 should probably be:

if (count(array_intersect($user_info['groups'], $exclude_groups)) == 0 && (($context['current_action'] != 'pm') || ($context['current_action'] == 'pm' && !empty($context['current_subaction']))) && !empty($modSettings['frp_min_mps']) && $user_info['unread_messages'] >= $modSettings['frp_min_mps'])
Title: Re: Force Read Pms
Post by: 4Kstore on March 11, 2013, 11:10:14 AM
Thanks, the error was fixed, this mod is only for member, we need check that before sorry.
Mod updated, if you want do the fix manual just open and edit Sources/ForcereadPms.php file

Search:
if (!empty($modSettings['frp_enabled']))

Replace with:
if (!empty($modSettings['frp_enabled']) && !$user_info['is_guest'])
Title: Re: Force Read Pms
Post by: Arantor on March 11, 2013, 11:13:44 AM
That still does not solve the bug that you have.

Let's say that admins are excluded from being forced to read PMs. In my forum admin is a secondary group but you're NOT CHECKING THAT. You're only checking the primary group and the post count group, not secondary groups.
Title: Re: Force Read Pms
Post by: 4Kstore on March 11, 2013, 11:26:00 AM
Thank, you are right...
I just update the mod and learn something new :D