fix for user groups!

main
hecht 14 years ago
parent 9813e7c62f
commit 395bba9500

@ -19,17 +19,18 @@ function displayUserLink($userid, $username = NULL, $clanpre = NULL, $clansu = N
function displayUserNameByID($userid, $showClanTags = TRUE){
if($userid === null){return '';}
$sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff, ads, gm from user left join clan on user.clan = clan.id where user.id = '.$userid;
$groups = getUserGroups($userid);
$sql = 'select nickname, user.id as userid, clan.clanz_pre, clan.clanz_suff from user left join clan on user.clan = clan.id where user.id = '.$userid;
$user_info = mysql_fetch_assoc(mysql_query($sql));
if($user_info['gm'] != 'nein'){
if($user_info['gm'] == 'ja'){
$color = 'style="color:'.$GLOBALS['COLOR_GM'].'"';
} else if($user_info['gm'] == 'et'){
$color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"';
} else if($user_info['gm'] == 'ka'){
$color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"';
}
} else if($user_info['ads'] == 1){
if(isUserInGroup(groups, admin)){
$color = 'style="color:'.$GLOBALS['COLOR_GM'].'"';
} else if(isUserInGroup(groups, entwickler)){
$color = 'style="color:'.$GLOBALS['COLOR_DEVELOPER'].'"';
} else if(isUserInGroup(groups, designer)){
$color = 'style="color:'.$GLOBALS['COLOR_CREATIVE'].'"';
} else if(isUserInGroup(groups, Werbung_an)){
$color = 'style="color:'.$GLOBALS['COLOR_SUPPORTER'].'"';
} else{
$color = '';

@ -26,13 +26,13 @@ function getUserGroups($user) {
if(is_numeric($user)) {
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz
INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
WHERE ugz.user_id = \''.$user.'\'';
WHERE ugz.user_id = \''.$user.'\'';
$qry = mysql_query($test);
} else if (validateString($user) != null) {
$test = 'SELECT ug.gruppen_name, ug.gruppen_id FROM user_gruppe_zuordnung as ugz
INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
INNER JOIN user as u ON u.id=ugz.user_id
WHERE u.nickname = \''.$user.'\'';
INNER JOIN user_gruppe as ug ON ugz.gruppen_id=ug.gruppen_id
INNER JOIN user as u ON u.id=ugz.user_id
WHERE u.nickname = \''.$user.'\'';
$qry = mysql_query($test);
}
@ -45,7 +45,7 @@ function getUserGroups($user) {
return $groups;
}
function isUserInGroup($usergrouparray, $group) {
function isUserInGroup(array $usergrouparray, $group) {
for($i = 0; $i < count($usergrouparray); $i++) {
if($usergrouparray[$i]['gruppen_id'] == $group) {
return true;

Loading…
Cancel
Save