You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When using a form that sends PM's to groups, It sends multiple individual PM's to each member of the group, rather than a single PM with multiple recipients. This flags the messages as pm flooding and prevents all but one of the messages from going through.
To Reproduce
Steps to reproduce the behavior:
Create a form that is set to send PM's to user groups with multiple users in the group.
Have a non-admin (Registered) user fill out and send the form.
See error
Expected behavior
When sending to a group, it should be sent as a single PM instead of several individual PM's.
Desktop (please complete the following information):
MyBB version: 1.8.36
Plugin version: 2.6.6
PHP version: 8.1.16
MySQL version: 5.7
I corrected this issue by changing the "get_usergroup_users" function in plugins/formcreator.php to only return an array of recipient userid's.
function get_usergroup_users_uid($gid)
{
global $db;
if (is_array($gid)) {
$additionwhere = "";
foreach ($gid as $groupid) {
$additionwhere .= " OR CONCAT(',',additionalgroups,',') LIKE '%," . intval($groupid) . ",%'";
}
$query = $db->simple_select("users", "uid", "usergroup IN (" . implode(",", $gid) . ")" . $additionwhere);
} else {
$query = $db->simple_select("users", "uid", "usergroup IN (" . intval($gid) . ") OR CONCAT(',',additionalgroups,',') LIKE '%," . intval($gid) . ",%'");
}
if ($db->num_rows($query)) {
$rownum = 0;
while ($user = $db->fetch_array($query)) {
$userarray[$rownum] = $user['uid'];
$rownum++;
}
return $userarray;
} else {
return false;
}
}
(This function is only called in form.php when sending PM's to groups)
once get_usergroup_users returns an array of receipients uids, then you can just set that as the "toid" value in the $pm array at line 260 (or so) in form.php
Describe the bug
When using a form that sends PM's to groups, It sends multiple individual PM's to each member of the group, rather than a single PM with multiple recipients. This flags the messages as pm flooding and prevents all but one of the messages from going through.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
When sending to a group, it should be sent as a single PM instead of several individual PM's.
Desktop (please complete the following information):
MyBB version: 1.8.36
Plugin version: 2.6.6
PHP version: 8.1.16
MySQL version: 5.7
I corrected this issue by changing the "get_usergroup_users" function in plugins/formcreator.php to only return an array of recipient userid's.
(This function is only called in form.php when sending PM's to groups)
once get_usergroup_users returns an array of receipients uids, then you can just set that as the "toid" value in the $pm array at line 260 (or so) in form.php
This solution worked for me, but I haven't tested it fully with other configurations
The text was updated successfully, but these errors were encountered: