aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/functions_user.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/functions_user.php')
-rw-r--r--phpBB/includes/functions_user.php18
1 files changed, 16 insertions, 2 deletions
diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php
index 7188ebeb52..daa571a790 100644
--- a/phpBB/includes/functions_user.php
+++ b/phpBB/includes/functions_user.php
@@ -2911,7 +2911,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
if (!sizeof($user_id_ary) || $result !== false)
{
- return false;
+ return 'NO_USERS';
}
if (!$group_name)
@@ -2923,9 +2923,23 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
{
case 'demote':
case 'promote':
+
+ $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
+ WHERE group_id = $group_id
+ AND user_pending = 1
+ AND " . $db->sql_in_set('user_id', $user_id_ary);
+ $result = $db->sql_query_limit($sql, 1);
+ $not_empty = ($db->sql_fetchrow($result));
+ $db->sql_freeresult($result);
+ if ($not_empty)
+ {
+ return 'NO_VALID_USERS';
+ }
+
$sql = 'UPDATE ' . USER_GROUP_TABLE . '
SET group_leader = ' . (($action == 'promote') ? 1 : 0) . "
WHERE group_id = $group_id
+ AND user_pending = 0
AND " . $db->sql_in_set('user_id', $user_id_ary);
$db->sql_query($sql);
@@ -3019,7 +3033,7 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna
group_update_listings($group_id);
- return true;
+ return false;
}
/**