News:

Wondering if this will always be free?  See why free is better.

Main Menu

Maximum Personal Messages limit by membergroup

Started by gasman, July 27, 2007, 12:55:31 AM

Previous topic - Next topic

gasman

I am having trouble administering the Maximum Personal Messages feature.What I want is all regular members to have a limit of 100 PMs in their inbox. I did this by editing all the post-based groups and limiting their PMs to 100.

Some members are Subscribers, and this is under "Additional Membergroups" on their profile. I set the Subscriber membergroup maximum to 1000 PMs in their inbox. This is one of the perks of being a subscriber on my forum.

Problem: when a Subscriber gets to 100 PM's, although their status bar shows 100 PM's and their Inbox is at 10%, they get a message saying they cannot recieve any more PMs as their Inbox is full. It seems the status bar reads from the Subscriber membergroup, but the limit is determined by the underlying Regular post-based membergroup.

How can I set a higher limit for an Additional Membergroup (in my case Subscriber) and a lower limit for all my other regular members, without causing this conflict???

Fiery

Well you could create membergroups specifically to set the number of personal messages.

For example create two additional membergroups.  One will be for people that you want to limit the max to 100 the other 1000.

Then place everyone in one group or another.  Then delete the limits set in the post count based groups.  This way the limits will be run by the two groups.

Let me know if this makes sense.

karlbenson

Does this sound like a bug?
Surely if a person is a member of multiple groups with different limits set on pms, the higher amount should be the one used.
Especially as gasman describes them being told they have 10% used, but actually it won't let them use anymore.

Fiery

Quote from: karlbenson on July 27, 2007, 03:38:28 PM
Does this sound like a bug?
Surely if a person is a member of multiple groups with different limits set on pms, the higher amount should be the one used.
Especially as gasman describes them being told they have 10% used, but actually it won't let them use anymore.

Well I dont know.  Let me post in the team area and see.

karlbenson

I'm look out for it with interest.

I've got a feeling that it may only be using the ID_GROUP or ID_POST_GROUP and not additionalGroups.

Smith6612

I believe that the PM limit thing is determined by the member's primary group. For example, if you have two groups for one user; One is Global Moderator and one is Website Staff. If Website Staff only allows 50 messages, while Global Moderators allow for unlimited, and Global Moderators is the main group for that user, if I am right, that user will be able to use an unlimited amount of space for PMs.

karlbenson

#6
Edit: I've done some bug testing and have managed to replicate it on fresh clean (no mods) installs of 1.1.2 and 1.1.3

It is definately a bug, but depends on how SMF intends the PM limit to work.

If the higher of Post Group, Primary Group or additionalGroups is used.  Then on attempting to post and checking whether the inbox is full, SMF is currently not taking into account the additionalGroups (as it is for the bar showing max/fullness)

OR if only Post Group or Primary Group matter
Then the bug is with the bar in that it is taking the additionalGroups into account aswell.

This is clearly shown in the screenshot.

To repeat the bug:
> create a new user
> set the 'newbie' post group to max 2pms
> create a new non-post group with max 3pms
> assign new user to non-post as AdditionalGroup
> login as that user
> send yourself 2 pm's
> try to send 3rd
> The Bar tells you that you can have upto 3
> But on posting the 3rd it tells you your inbox is full



Personally, I think AdditionalGroups SHOULD be taken into account.  For example. You may use the paid subscriptions mod and want 'charter members' to have a higher pm limit. That would be stored as an additionalGroup, so the user would only get their Primary or PostGroup amount of PM's.

Smith6612

A bug it is... well, there's some Developer food for the devs. Nice noticing this :D

karlbenson

Thanks ;)
I wouldnt have noticed it, other than I was in the middle of coding queries on the members and membergroups tables and making it so where there multiple membergroups, the higher figure counts.

(For my ad revenue sharing mod which I'm in the middle of re-writing)

gasman

Quote from: pmp6nl on July 27, 2007, 02:53:14 PM
Well you could create membergroups specifically to set the number of personal messages.

For example create two additional membergroups.  One will be for people that you want to limit the max to 100 the other 1000.

Then place everyone in one group or another.  Then delete the limits set in the post count based groups.  This way the limits will be run by the two groups.

Let me know if this makes sense.

I don't want to manually place every new member into a primary group. All new members should by default be a member of a post-based group, and then those who subscribe get placed into an Additional Membergroup (Subscriber).

I can't make Subscribers a new primary group because I already have some Global Moderators (a Primary membergroup) who are also Subscibers (Additional Membergroup) who need to be members of both groups.

I think this is definitely a bug. The forum should take as its max PM from the highest limit from any membergroup (post-based, Primary or Additional)

karlbenson

#10
The bug is the difference between the queries in
PersonalMessage.php @ around line 124
(gives the max messages figure to the info pm bar.

$request = db_query("
SELECT MAX(maxMessages) AS topLimit, MIN(maxMessages) AS bottomLimit
FROM {$db_prefix}membergroups
WHERE ID_GROUP IN (" . implode(', ', $user_info['groups']) . ')', __FILE__, __LINE__);

(Note the $user_groups includes the additional membergroups in load.php @ 460)
$user_info = array(
'groups' => array_merge(
array($user_settings['ID_GROUP'], $user_settings['ID_POST_GROUP']),
explode(',', $user_settings['additionalGroups'])
)
);




and in subs-post.php @ around line 760-776

$request = db_query("
SELECT
mem.memberName, mem.realName, mem.ID_MEMBER, mem.emailAddress, mem.lngfile, mg.maxMessages,
mem.pm_email_notify, mem.instantMessages," . (allowedTo('moderate_forum') ? ' 0' : "
(mem.pm_ignore_list = '*' OR FIND_IN_SET($from[id], mem.pm_ignore_list))") . " AS ignored,
FIND_IN_SET($from[id], mem.buddy_list) AS is_buddy, mem.is_activated,
(mem.ID_GROUP = 1 OR FIND_IN_SET(1, mem.additionalGroups)) AS is_admin
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
WHERE mem.ID_MEMBER IN (" . implode(", ", $all_to) . ")
ORDER BY mem.lngfile
LIMIT " . count($all_to), __FILE__, __LINE__);
$notifications = array();
while ($row = mysql_fetch_assoc($request))
{
// Has the receiver gone over their message limit, assuming that neither they nor the sender are important?!
if (!empty($row['maxMessages']) && $row['maxMessages'] <= $row['instantMessages'] && !allowedTo('moderate_forum') && !$row['is_admin'])
{

Although additionalGroups are checked as part if the user is admin or not, they do get queried to obtain the maxMessages

Fiery

This has been reported to the bug tracker...

---

You would not need to set new members manually, it can be done automatically from Admin --> Registration --> Primary Membergroup

You could leave the global moderators as the primary membergroup then add the subscribers to an "Additional Membergroup"

karlbenson

Thanks for adding it to the bugtracker, Pmp6nl.

I don't think your second part will work.  If subscribers were allowed 10 pms and global mods 8
Then they would also get 8. (although it says they have room for 10)

I tried to figure out a temporary figure, but that mysql involved is kind of complex and above my level. ;)

mcalan2001

Quote from: gasman on July 27, 2007, 06:39:08 PM
I think this is definitely a bug. The forum should take as its max PM from the highest limit from any membergroup (post-based, Primary or Additional)

I do see a problem with that. By default all the membergroups are set to unlimited. So I would suggest that this shouldn't count as a highest limit.

karlbenson

Thinking about it Mcalan2001, you may be right.
In the database its stored as 0 for unlimited.

This may need some changes to the figure that is stored.
For example on my forum, I'd like to set my premium/charter users to have unlimited pms, while restricting the rest to 20.

Maybe use -1 for unset (eg it won't impact, its ignored)
0 for unlimited
1 to the -n'th for set amount

Fiery

Quote from: karlbenson on July 28, 2007, 11:33:08 AM
Thanks for adding it to the bugtracker, Pmp6nl.

I don't think your second part will work.  If subscribers were allowed 10 pms and global mods 8
Then they would also get 8. (although it says they have room for 10)

I tried to figure out a temporary figure, but that mysql involved is kind of complex and above my level. ;)

Well then you could give the mods 10 also  ;D

Hummm, let me think

karlbenson

Its just working out the logic so admins don't get in a twizzle.

If SMF can do half the work for them.... ;)

gasman

Can anyone tell me if this bug is addressed in the latest (1.1.4) public release? It is not mentioned in the release notes, so I assume it is not.

karlbenson

I was thinking about this the other day and wondered too.

I'm unsure.

merm

I'm so glad to hear this was verified as a bug. Any indication on when this might be resolved?

metallica48423

pmp6nl, i looked in the bug tracker for this, but couldn't find it, is it still open or is it resolved?

Justin O'Leary
Ex-Project Manager
Ex-Lead Support Specialist

QuoteMicrosoft wants us to "Imagine life without walls"...
I say, "If there are no walls, who needs Windows?"


Useful Links:
Online Manual!
How to Help us Help you
Search
Settings Repair Tool

Fiery

#21
Good question.

I am not sure, I cant find it...

Stüldt Håjt

I'd like to see this bug fixed too. I have same problems as I want certain members to have more pm's.

Fiery

This w
Quote from: Stüldt Håjt on January 16, 2008, 12:05:26 PM
I'd like to see this bug fixed too. I have same problems as I want certain members to have more pm's.

Its in the bug tracker ;)

THE BRA1N

This sounds like the problem I am having. I have a Global Mod whose primary group is set to unlimited PMs but everyone gets an "inbox full" message when they PM him except admins.

Seems like the 0 unlimited setting is being overridden by something because when I set the limit to 800 (he likes to save all his PMs for some reason), the PMs finally go though. Yet if I change it back to 0, the full message comes back up again.

Recently his primary user group changed from Global, to something else which had a 200 PM limit and back to Global. Any thoughts?

Rumbaar

Well I haven't read the whole (OLD) thread.

But if you set the Regular Member PM limit to a level, leave all Post Count groups to 0 (unlimited) the Regular Members membergroup would control all other general users limits.  Then the special primary membergroups would override the Regular Members limit.  So adding them to Global Moderator with a limit of 200 should now work.
"An important reward for a job well done is a personal sense of worthwhile achievement."

[ Themes ]

Biology Forums

#26
Did this ever get fixed?

I find that what SMF does right is that it doesn't show the bar for members that are unlimited, for instance.

It does this by the following code found in PersonalMessage.php

// Load up the members maximum message capacity.
if (!$user_info['is_admin'])
{
// !!! Why do we do this?  It seems like if they have any limit we should use it.
$request = db_query("
SELECT MAX(maxMessages) AS topLimit, MIN(maxMessages) AS bottomLimit
FROM {$db_prefix}membergroups
WHERE ID_GROUP IN (" . implode(', ', $user_info['groups']) . ')', __FILE__, __LINE__);
list ($maxMessage, $minMessage) = mysql_fetch_row($request);
mysql_free_result($request);

$context['message_limit'] = $minMessage == 0 ? 0 : $maxMessage;
}
else
$context['message_limit'] = 0;

// Prepare the context for the capacity bar.
if (!empty($context['message_limit']))
{
$bar = ($user_info['messages'] * 100) / $context['message_limit'];

$context['limit_bar'] = array(
'messages' => $user_info['messages'],
'allowed' => $context['message_limit'],
'percent' => $bar,
'bar' => min(100, (int) $bar),
'text' => sprintf($txt['pm_currently_using'], $user_info['messages'], round($bar, 1)),
);
}


But, when a message is being sent (being passed to Subs-Post.php), this is was controls the error, which doesn't take into account min and max values:

$request = db_query("
SELECT
mem.memberName, mem.realName, mem.ID_MEMBER, mem.emailAddress, mem.lngfile, mg.maxMessages,
mem.pm_email_notify, mem.instantMessages," . (allowedTo('moderate_forum') ? ' 0' : "
(mem.pm_ignore_list = '*' OR FIND_IN_SET($from[id], mem.pm_ignore_list))") . " AS ignored,
FIND_IN_SET($from[id], mem.buddy_list) AS is_buddy, mem.is_activated,
(mem.ID_GROUP = 1 OR FIND_IN_SET(1, mem.additionalGroups)) AS is_admin, mg.onlineColor
FROM {$db_prefix}members AS mem
LEFT JOIN {$db_prefix}membergroups AS mg ON (mg.ID_GROUP = IF(mem.ID_GROUP = 0, mem.ID_POST_GROUP, mem.ID_GROUP))
WHERE mem.ID_MEMBER IN (" . implode(", ", $all_to) . ")
ORDER BY mem.lngfile
LIMIT " . count($all_to), __FILE__, __LINE__);
$notifications = array();
while ($row = mysql_fetch_assoc($request))
{
// Has the receiver gone over their message limit, assuming that neither they nor the sender are important?!
if (!empty($row['maxMessages']) && $row['maxMessages'] <= $row['instantMessages'] && !allowedTo('moderate_forum') && !$row['is_admin'])
{
$log['failed'][] = sprintf($txt['pm_error_data_limit_reached'], $row['realName']);
unset($all_to[array_search($row['ID_MEMBER'], $all_to)]);
continue;
}

Advertisement: