1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[ticket/11358] Enabled link making all users default for a group.

Detect whether link is clicked or form is posted for making users
default for a group. If form is posted and no users are selected,
validation happens and displays an error message. When the link is
clicked, all the users will be default users for that group.

PHPBB3-11358
This commit is contained in:
erangamapa 2013-02-22 00:31:55 +05:30 committed by Nils Adermann
parent 880786d686
commit 538b09ba61

View File

@ -120,7 +120,7 @@ class acp_groups
{
trigger_error($user->lang['NO_GROUP'] . adm_back_link($this->u_action), E_USER_WARNING);
}
else if (empty($mark_ary))
else if (empty($mark_ary) && $request->is_set_post('default'))
{
trigger_error($user->lang['NO_USERS'] . adm_back_link($this->u_action . '&action=list&g=' . $group_id), E_USER_WARNING);
}
@ -128,7 +128,45 @@ class acp_groups
if (confirm_box(true))
{
$group_name = ($group_row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $group_row['group_name']] : $group_row['group_name'];
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
if (!sizeof($mark_ary))
{
$start = 0;
do
{
$sql = 'SELECT user_id
FROM ' . USER_GROUP_TABLE . "
WHERE group_id = $group_id
ORDER BY user_id";
$result = $db->sql_query_limit($sql, 200, $start);
$mark_ary = array();
if ($row = $db->sql_fetchrow($result))
{
do
{
$mark_ary[] = $row['user_id'];
}
while ($row = $db->sql_fetchrow($result));
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
$start = (sizeof($mark_ary) < 200) ? 0 : $start + 200;
}
else
{
$start = 0;
}
$db->sql_freeresult($result);
}
while ($start);
}
else
{
group_user_attributes('default', $group_id, $mark_ary, false, $group_name, $group_row);
}
trigger_error($user->lang['GROUP_DEFS_UPDATED'] . adm_back_link($this->u_action . '&amp;action=list&amp;g=' . $group_id));
}
else