aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_users.html28
-rw-r--r--phpBB/includes/acp/acp_groups.php15
-rw-r--r--phpBB/includes/acp/acp_users.php140
-rw-r--r--phpBB/language/en/acp/users.php9
-rw-r--r--phpBB/language/en/ucp.php2
5 files changed, 192 insertions, 2 deletions
diff --git a/phpBB/adm/style/acp_users.html b/phpBB/adm/style/acp_users.html
index 7238c45ba0..9f4eb84553 100644
--- a/phpBB/adm/style/acp_users.html
+++ b/phpBB/adm/style/acp_users.html
@@ -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}">
diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php
index 35f6f61936..44b763b310 100644
--- a/phpBB/includes/acp/acp_groups.php
+++ b/phpBB/includes/acp/acp_groups.php
@@ -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&amp;i=users&amp;mode=groups&amp;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}&amp;action=$action&amp;g=$group_id",
'L_AVATAR_EXPLAIN' => sprintf($user->lang['AVATAR_EXPLAIN'], $config['avatar_max_width'], $config['avatar_max_height'], round($config['avatar_filesize'] / 1024)),
diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php
index 57f685997f..1aa5e135aa 100644
--- a/phpBB/includes/acp/acp_users.php
+++ b/phpBB/includes/acp/acp_users.php
@@ -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 . '&amp;u=' . $user_id));
+ }
+
+ if ($error = group_user_del($group_id, $user_id))
+ {
+ trigger_error($user->lang[$error] . adm_back_link($u_action . '&amp;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 . '&amp;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 . '&amp;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&amp;i=groups&amp;mode=manage&amp;action=edit&amp;u=$user_id&amp;g=" . $data['group_id'] . '&amp;back_link=acp_users_groups',
+ 'U_DEFAULT' => $u_action . "&amp;action=default&amp;u=$user_id&amp;g=" . $data['group_id'],
+ 'U_DEMOTE_PROMOTE' => $u_action . '&amp;action=' . (($data['group_leader']) ? 'demote' : 'promote') . "&amp;u=$user_id&amp;g=" . $data['group_id'],
+ 'U_DELETE' => $u_action . "&amp;action=delete&amp;u=$user_id&amp;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
diff --git a/phpBB/language/en/acp/users.php b/phpBB/language/en/acp/users.php
index 82e1ae4466..b6321b038b 100644
--- a/phpBB/language/en/acp/users.php
+++ b/phpBB/language/en/acp/users.php
@@ -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',
diff --git a/phpBB/language/en/ucp.php b/phpBB/language/en/ucp.php
index 74b2689c74..2abaa91f72 100644
--- a/phpBB/language/en/ucp.php
+++ b/phpBB/language/en/ucp.php
@@ -466,4 +466,4 @@ $lang = array_merge($lang, array(
'JOIN_MARKED' => 'Join marked',
));
-?>
+?> \ No newline at end of file