mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-27 21:58:52 +00:00
- and finally, user groups. :)
git-svn-id: file:///svn/phpbb/trunk@5366 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
f4f2ab3a35
commit
1ec71c78b6
5 changed files with 192 additions and 2 deletions
|
@ -600,6 +600,34 @@
|
|||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_GROUPS -->
|
||||
|
||||
<form id="user_groups" method="post" action="{U_ACTION}">
|
||||
|
||||
<table cellspacing="1">
|
||||
<tbody>
|
||||
<!-- BEGIN group -->
|
||||
<!-- IF group.S_NEW_GROUP_TYPE -->
|
||||
<tr>
|
||||
<td class="row3" colspan="4"><b>{group.GROUP_TYPE}</b></td>
|
||||
</tr>
|
||||
<!-- ELSE -->
|
||||
<!-- IF group.S_ROW_COUNT is even --><tr class="row1"><!-- ELSE --><tr class="row2"><!-- ENDIF -->
|
||||
<td><a href="{group.U_EDIT_GROUP}">{group.GROUP_NAME}</a></td>
|
||||
<td><!-- IF group.S_NO_DEFAULT --><a href="{group.U_DEFAULT}">{L_GROUP_DEFAULT}</a><!-- ELSE -->{L_GROUP_DEFAULT}<!-- ENDIF --></td>
|
||||
<td><!-- IF not group.S_SPECIAL_GROUP --><a href="{group.U_DEMOTE_PROMOTE}">{group.L_DEMOTE_PROMOTE}</a><!-- ENDIF --></td>
|
||||
<td><a href="{group.U_DELETE}">{L_GROUP_DELETE}</a></td>
|
||||
<!-- ENDIF -->
|
||||
<!-- END group -->
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<fieldset class="quick">
|
||||
{L_USER_GROUP_ADD}: <select name="g">{S_GROUP_OPTIONS}</select> <input class="button1" type="submit" name="update" value="{L_SUBMIT}" />
|
||||
</fieldset>
|
||||
|
||||
</form>
|
||||
|
||||
<!-- ELSEIF S_ATTACHMENTS -->
|
||||
|
||||
<form id="user_attachments" method="post" action="{U_ACTION}">
|
||||
|
|
|
@ -385,6 +385,19 @@ class acp_groups
|
|||
avatar_gallery($category, $avatar_select, 4);
|
||||
}
|
||||
|
||||
$back_link = request_var('back_link', '');
|
||||
|
||||
switch ($back_link)
|
||||
{
|
||||
case 'acp_users_groups':
|
||||
$u_back = $phpbb_admin_path . "index.$phpEx$SID&i=users&mode=groups&u=" . request_var('u', 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
$u_back = $u_action;
|
||||
break;
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_EDIT' => true,
|
||||
'S_INCLUDE_SWATCH' => true,
|
||||
|
@ -416,7 +429,7 @@ class acp_groups
|
|||
'GROUP_CLOSED' => $type_closed,
|
||||
'GROUP_HIDDEN' => $type_hidden,
|
||||
|
||||
'U_BACK' => $u_action,
|
||||
'U_BACK' => $u_back,
|
||||
'U_SWATCH' => "{$phpbb_admin_path}swatch.$phpEx$SID&form=settings&name=group_colour",
|
||||
'U_ACTION' => "{$u_action}&action=$action&g=$group_id",
|
||||
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
|
||||
|
|
|
@ -1558,6 +1558,146 @@ class acp_users
|
|||
);
|
||||
|
||||
break;
|
||||
|
||||
case 'groups':
|
||||
|
||||
$user->add_lang('groups');
|
||||
$group_id = request_var('g', 0);
|
||||
|
||||
switch ($action)
|
||||
{
|
||||
case 'demote':
|
||||
case 'promote':
|
||||
case 'default':
|
||||
group_user_attributes($action, $group_id, $user_id);
|
||||
|
||||
if ($action == 'default')
|
||||
{
|
||||
$user_row['group_id'] = $group_id;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
||||
if (confirm_box(true))
|
||||
{
|
||||
if (!$group_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($u_action . '&u=' . $user_id));
|
||||
}
|
||||
|
||||
if ($error = group_user_del($group_id, $user_id))
|
||||
{
|
||||
trigger_error($user->lang[$error] . adm_back_link($u_action . '&u=' . $user_id));
|
||||
}
|
||||
|
||||
$error = array();
|
||||
}
|
||||
else
|
||||
{
|
||||
confirm_box(false, $user->lang['CONFIRM_OPERATION'], build_hidden_fields(array(
|
||||
'u' => $user_id,
|
||||
'i' => $id,
|
||||
'mode' => $mode,
|
||||
'action' => $action,
|
||||
'g' => $group_id))
|
||||
);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// Add user to group?
|
||||
if ($submit)
|
||||
{
|
||||
if (!$group_id)
|
||||
{
|
||||
trigger_error($user->lang['NO_GROUP'] . adm_back_link($u_action . '&u=' . $user_id));
|
||||
}
|
||||
|
||||
// Add user/s to group
|
||||
if ($error = group_user_add($group_id, $user_id))
|
||||
{
|
||||
trigger_error($user->lang[$error] . adm_back_link($u_action . '&u=' . $user_id));
|
||||
}
|
||||
|
||||
$error = array();
|
||||
}
|
||||
|
||||
|
||||
$sql = 'SELECT ug.*, g.*
|
||||
FROM ' . GROUPS_TABLE . ' g, ' . USER_GROUP_TABLE . " ug
|
||||
WHERE ug.user_id = $user_id
|
||||
AND g.group_id = ug.group_id
|
||||
ORDER BY g.group_type DESC, ug.user_pending ASC, g.group_name";
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$i = 0;
|
||||
$group_data = $id_ary = array();
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$type = ($row['group_type'] == GROUP_SPECIAL) ? 'special' : (($row['user_pending']) ? 'pending' : 'normal');
|
||||
|
||||
$group_data[$type][$i]['group_id'] = $row['group_id'];
|
||||
$group_data[$type][$i]['group_name'] = $row['group_name'];
|
||||
$group_data[$type][$i]['group_leader'] = ($row['group_leader']) ? 1 : 0;
|
||||
|
||||
$id_ary[] = $row['group_id'];
|
||||
|
||||
$i++;
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
// Select box for other groups
|
||||
$sql = 'SELECT group_id, group_name, group_type
|
||||
FROM ' . GROUPS_TABLE . '
|
||||
WHERE group_id NOT IN (' . implode(', ', $id_ary) . ')
|
||||
ORDER BY group_type DESC, group_name ASC';
|
||||
$result = $db->sql_query($sql);
|
||||
|
||||
$s_group_options = '';
|
||||
while ($row = $db->sql_fetchrow($result))
|
||||
{
|
||||
$s_group_options .= '<option' . (($row['group_type'] == GROUP_SPECIAL) ? ' class="sep"' : '') . ' value="' . $row['group_id'] . '">' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . '</option>';
|
||||
}
|
||||
$db->sql_freeresult($result);
|
||||
|
||||
$current_type = '';
|
||||
foreach ($group_data as $group_type => $data_ary)
|
||||
{
|
||||
if ($current_type != $group_type)
|
||||
{
|
||||
$template->assign_block_vars('group', array(
|
||||
'S_NEW_GROUP_TYPE' => true,
|
||||
'GROUP_TYPE' => $user->lang['USER_GROUP_' . strtoupper($group_type)])
|
||||
);
|
||||
}
|
||||
|
||||
foreach ($data_ary as $data)
|
||||
{
|
||||
$template->assign_block_vars('group', array(
|
||||
'U_EDIT_GROUP' => "{$phpbb_admin_path}index.$phpEx$SID&i=groups&mode=manage&action=edit&u=$user_id&g=" . $data['group_id'] . '&back_link=acp_users_groups',
|
||||
'U_DEFAULT' => $u_action . "&action=default&u=$user_id&g=" . $data['group_id'],
|
||||
'U_DEMOTE_PROMOTE' => $u_action . '&action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&u=$user_id&g=" . $data['group_id'],
|
||||
'U_DELETE' => $u_action . "&action=delete&u=$user_id&g=" . $data['group_id'],
|
||||
|
||||
'GROUP_NAME' => ($group_type == 'special') ? $user->lang['G_' . $data['group_name']] : $data['group_name'],
|
||||
'L_DEMOTE_PROMOTE' => ($data['group_leader']) ? $user->lang['GROUP_DEMOTE'] : $user->lang['GROUP_PROMOTE'],
|
||||
|
||||
'S_NO_DEFAULT' => ($user_row['group_id'] != $data['group_id']) ? true : false,
|
||||
'S_SPECIAL_GROUP' => ($group_type == 'special') ? true : false,
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign_vars(array(
|
||||
'S_GROUPS' => true,
|
||||
'S_GROUP_OPTIONS' => $s_group_options)
|
||||
);
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
// Assign general variables
|
||||
|
|
|
@ -43,6 +43,11 @@ $lang = array_merge($lang, array(
|
|||
'FOUNDER' => 'Founder',
|
||||
'FOUNDER_EXPLAIN' => 'Founders can never be banned, deleted or altered by non-founder members',
|
||||
|
||||
'GROUP_DEFAULT' => 'Default',
|
||||
'GROUP_DELETE' => 'Delete',
|
||||
'GROUP_DEMOTE' => 'Demote',
|
||||
'GROUP_PROMOTE' => 'Promote',
|
||||
|
||||
'IP_WHOIS_FOR' => 'IP whois for %s',
|
||||
|
||||
'LAST_ACTIVE' => 'Last active',
|
||||
|
@ -82,6 +87,10 @@ $lang = array_merge($lang, array(
|
|||
'USER_AVATAR_UPDATED' => 'Successfully updated user avatars details',
|
||||
'USER_CUSTOM_PROFILE_FIELDS' => 'Custom profile fields',
|
||||
'USER_DELETED' => 'User deleted successfully',
|
||||
'USER_GROUP_ADD' => 'Add user to group',
|
||||
'USER_GROUP_NORMAL' => 'Normal groups user is a member of',
|
||||
'USER_GROUP_PENDING' => 'Groups user is in pending mode',
|
||||
'USER_GROUP_SPECIAL' => 'Special groups user is a member of',
|
||||
'USER_OVERVIEW_UPDATED' => 'User details updated',
|
||||
'USER_POSTS_DELETED' => 'Successfully removed all posts made by this user',
|
||||
'USER_POSTS_MOVED' => 'Successfully moved users posts to target forum',
|
||||
|
|
|
@ -466,4 +466,4 @@ $lang = array_merge($lang, array(
|
|||
'JOIN_MARKED' => 'Join marked',
|
||||
));
|
||||
|
||||
?>
|
||||
?>
|
Loading…
Add table
Reference in a new issue