News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Allowed no. of Free PM by no of posts.

Started by fiver, August 22, 2008, 09:19:08 AM

Previous topic - Next topic

fiver

Hi,

Can anyone help me with coding something for this? This is how I imagine it works:

1. When a member click on My Messages, it checks how many post made in the last 24 hour (number of hours can be adjusted in admin panel).

2. If there are 3 posts made, there'll be a message like "You are able to send 3 PM."

I'm hoping this function will keep forum discussions in the "front" (on discussion boards) and less at the "back" through PM, without having to disable PM totally.

Hope to hear from some experts here.

:)


kizer

You do realize making people post in a PM will make your forum appear less active.
Own a Jeep? Links4Jeeps.com

[SiNaN]

Hope I got it correctly.

../Sources/PersonalMessage.php

Find:

global $txt, $context, $scripturl, $sc, $modSettings, $settings, $user_info;

Replace:

global $txt, $context, $scripturl, $sc, $modSettings, $settings, $user_info, $ID_MEMBER, $db_prefix;

Find:

$context['template_layers'][] = 'pm';

Replace:

$context['template_layers'][] = 'pm';

list ($modSettings['max_pm_recipients'], $modSettings['pm_posts_verification'], $modSettings['pm_posts_per_hour']) = explode(',', $modSettings['pm_spam_settings']);

if (!empty($modSettings['pm_posts_per_hour']))
{
$request = db_query("
SELECT COUNT(pr.ID_PM) AS postCount
FROM ({$db_prefix}personal_messages AS pm, {$db_prefix}pm_recipients AS pr)
WHERE pm.ID_MEMBER_FROM = $ID_MEMBER
AND pm.msgtime > " . (time() - 3600) . "
AND pr.ID_PM = pm.ID_PM", __FILE__, __LINE__);
list ($postCount) = mysql_fetch_row($request);
mysql_free_result($request);

if (!empty($postCount))
{
$request = db_query("
SELECT ID_MEMBER
FROM {$db_prefix}moderators
WHERE ID_MEMBER = $ID_MEMBER", __FILE__, __LINE__);
if (mysql_num_rows($request) == 0)
$context['allowed_pm_left'] = $modSettings['pm_posts_per_hour'] - $postCount;
mysql_free_result($request);
}
}


You can use $context['allowed_pm_left'] in PersonalMessage.template.php file.
Former SMF Core Developer | My Mods | SimplePortal

fiver

Quote from: kizer on August 22, 2008, 11:31:01 AM
You do realize making people post in a PM will make your forum appear less active.

Hi kizer,

I don't mean post in a PM. At the moment PM has been disabled for members for the last 3 years, and the reason is to prevent members from using PM privately and at the same time inactive in the boards. So I thought if I come up with a compromise (as in the 1st post) and also prevent more PM than post at the same time.

fiver

Quote from: [SiNaN] on August 23, 2008, 11:04:38 AM
Hope I got it correctly.

Many thanks SiNan. I'll package and install it, and give it a go.

kizer

Many apologies. Your giving them PM privledges from posting. Ah very intresting I must say. I at first thought you where discouraging people from posting and wanted them to PM.
Own a Jeep? Links4Jeeps.com

fiver

Quote from: kizer on August 25, 2008, 02:49:41 PM
Many apologies. Your giving them PM privledges from posting. Ah very intresting I must say. I at first thought you where discouraging people from posting and wanted them to PM.

No problem ;)

fiver

Hi [SiNaN]

Just to confirm with you. Where do I set the number of hours? Also, when someone click My Messages, how do I add a line under

Show unread posts since last visit.
                        Show new replies to your posts.
                        Total time logged in:
Number of free PM: 3

Does you code only affect post group? I hope it won't affect Global Moderators, Moderators and Admin.

Many thanks again for your help.

:D


[SiNaN]

You can change the hour, in the codes I gave above you should change 3600. It is seconds. So if you want two hours, it will be 7200; if 3 hours, 10800.

What's your theme?

Well, we can make it like that:

Find:

   if (!empty($modSettings['pm_posts_per_hour']))

Replace:

   if (!empty($modSettings['pm_posts_per_hour']) && !allowedTo(array('admin_forum', 'moderate_forum', 'send_mail')))

Admin and moderators will not be affected.
Former SMF Core Developer | My Mods | SimplePortal

fiver

Hi,

I installed and after which only admin is able to post. When Normal members and even Global Mod try to submit a post, they get this message:

An Error Has Occurred!
The last posting from your IP was less than 1 minute ago. Please try again later.

Any help to fix the bug pls? Thks.

[SiNaN]

I don't think this is related to those codes above. Just to make sure, remove them and try again.
Former SMF Core Developer | My Mods | SimplePortal

fiver

Hi the error seems to have gone.

I tested under normal member account. Posted 4 posts and still able to send 6 pm. No block after sending 4 pm. Also would be good if there are some indicator like, Free PM available: 0.

Thks for your time and afford. Really appreciate it.

[SiNaN]

Are you sure that you've set "Number of personal messages a user may send in an hour." setting correctly in Admin CP >> Features and Options?
Former SMF Core Developer | My Mods | SimplePortal

fiver


assam_siddibapa

Can some one make this a mod .. it will be great

bfeo

Wouldn't having pm limit and inbox size by membergroup be alot more useful?  I'd personally like to see that.  I'll start a thread if you'd like.


fiver

Hi [SiNaN],

I wonder should I set the Limit to 0 and let your codes do the control?

[SiNaN]

The codes a gave just shows the left count, it doesn't block. So your problem is they aren't blocked?
Former SMF Core Developer | My Mods | SimplePortal

fiver

Quote from: Blue Dream on September 08, 2008, 12:19:35 PM
Are you sure that you've set "Number of personal messages a user may send in an hour." setting correctly in Admin CP >> Features and Options?
Hi Blue Dream,
I'm still very keen to get this idea working. What should I set for "Number of personal messages a user may send in an hour."?
Thanks.

[SiNaN]

You should set is as the count of personal messages you want them to be able to send in an hour.
Former SMF Core Developer | My Mods | SimplePortal

fiver

Hi Blue Dream,

Today I installed the codes. Then I allowed one test account "testG3" to Read and Send personal messages in the permission. Next I login as testG3 and manage to send a PM to admin (me).

The last time testG3 posted was July 16, 2008.

I was hoping testG3 will not be allowed to send PM if he did not post in the last 24 hours (I use 86400 in the code).

Wondering why the PM is sent through.

[SiNaN]

Reading your posts again, I see I misunderstood what you wanted. You want your users to be able to pm as much as they post, right? In that case, I suggest creating a topic in Mod Requests board, as this requires more than a few line edits I believe; or ask a moderator to move your topic.
Former SMF Core Developer | My Mods | SimplePortal

fiver

Thanks Blue Dream. That's correct.

Moderator,
Please move this topic to Mod Request?
Thanks.

[SiNaN]

Former SMF Core Developer | My Mods | SimplePortal

chrishicks

This would be a great mod for my forum as I'm getting some of the Myspace crowd and all they ever do is PM. I don't want to completely disable PMs just yet as a few have slowly moved out to make a post from time to time.

I would like to suggest that it be customizable in that we could set it to say a 3:1 ratio or whatever if possible. I can see a 1:1 chasing people off so that wouldn't work for me. If they only had to make 1 post in order to send 3 PMs I think they would adjust easier.

chrishicks

Just a bump for this to see if anyone else is interested.

chrishicks


Arantor

I'm sure you can limit the total PMs they have by post group, but limiting it the way you're suggesting is pretty complex.

chrishicks

I currently have a good 6 different post groups for just this reason but even though I place limits on number of PMs they just delete old messages and continue on. I've been trying to figure out other ways of doing this without just completely eliminating PMs altogether. A mod such as this would be great but I'd be open to any type of suggestions.

Advertisement: