Increase the Amount of pm's that can be Sent per Hour by Membergroup

Started by br360, July 30, 2013, 12:28:55 PM

Previous topic - Next topic

br360

I have the amount of private messages a member can send per hour set at 10. I know that admins and global mods are exempt and can send as many as they want, but I was wondering if there was a way to increase the number allowed by specific membergroups as well.

I have a member group called "newbie mod" (helps out new members) and he can get a lot of pm's from them asking specific questions. Since he is limited to sending 10 pm's per hour, it sometimes takes him a while to respond to some other members. Is there a way to be able to increase the amount of pm's that can be sent for that specific membergroup?

Thanks.

Kindred

Слова
Украина

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

br360

Well I guess the good news is that I can stop looking through every section of the admin panel in case I had missed it. ;)

Thanks for the reply.

MrPhil

It should be possible to add the "newbie mod" group to the place where admins and global mods are excluded from the 10/hour limit. It would be a custom code change. You'll first need to find out the group ID number of that group.

Kindred

Hmmmm....
http://custom.simplemachines.org/mods/index.php?mod=3024

the presence of this mod (albeit for 1.1) does suggest that a PM limit by membergroup HAS been done before.
Слова
Украина

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

br360

Quote from: MrPhil on July 30, 2013, 01:38:57 PM
It should be possible to add the "newbie mod" group to the place where admins and global mods are excluded from the 10/hour limit. It would be a custom code change. You'll first need to find out the group ID number of that group.

Finding the membergroup ID is the easy part. lol.

Any idea where would I need to edit the code?


MrPhil

In Themes/Sources/PersonalMessage.php, it would appear that this is the magic place:
// Check whether we've gone over the limit of messages we can send per hour.
if (!empty($modSettings['pm_posts_per_hour']) && !allowedTo(array('admin_forum', 'moderate_forum', 'send_mail')) && $user_info['mod_cache']['bq'] == '0=1' && $user_info['mod_cache']['gq'] == '0=1')
{

The idea would be to add a check at the end that if this user was a member of the "newbie mod" group, and if so, make the test fail:
// Check whether we've gone over the limit of messages we can send per hour.
if (!empty($modSettings['pm_posts_per_hour']) && !allowedTo(array('admin_forum', 'moderate_forum', 'send_mail')) && $user_info['mod_cache']['bq'] == '0=1' && $user_info['mod_cache']['gq'] == '0=1' && !in_group(member_id, 'newbie_mod'))
{

Off the top of my head I can't tell you how to check if this member is part of a group, though it's probably done in plenty of places throughout the code.

I explored instead extending the allowedTo() function by adding a new 'newbieMod' element, and extending the permissions checked in Themes/Sources/Security.php. That depends on $user_info['permissions'], and I haven't gone far enough through the code to see where membership in the "newbie mod" group could be added to this permission array. It may be in Load.php.

Maybe that's enough to get you going, or someone else can chime in with a good way to do one of these two approaches (or suggest another one). It's getting late and I have to turn in... maybe I can look at it again tomorrow night if you're still stuck.

Advertisement: