diff --git a/wp-admin/b2team.php b/wp-admin/b2team.php index 25f196995c..45afc705f9 100644 --- a/wp-admin/b2team.php +++ b/wp-admin/b2team.php @@ -44,7 +44,7 @@ case 'promote': } elseif ('down' == $prom) { $sql="UPDATE $tableusers SET user_level=user_level-1 WHERE ID = $id"; } - $result = mysql_query($sql) or die("Couldn't change $id's level."); + $result = $wpdb->query($sql); header('Location: b2team.php'); @@ -62,16 +62,16 @@ case 'delete': } $user_data = get_userdata($id); - $usertodelete_level = $user_data[13]; + $usertodelete_level = $user_data->user_level; if ($user_level <= $usertodelete_level) die('Can’t delete an user whose level is higher than yours.'); - $sql="DELETE FROM $tableusers WHERE ID = $id"; - $result = mysql_query($sql) or die("Couldn’t delete user #$id."); + $sql = "DELETE FROM $tableusers WHERE ID = $id"; + $result = $wpdb->query($sql) or die("Couldn’t delete user #$id."); - $sql="DELETE FROM $tableposts WHERE post_author = $id"; - $result = mysql_query($sql) or die("Couldn’t delete user #$id’s posts."); + $sql = "DELETE FROM $tableposts WHERE post_author = $id"; + $result = $wpdb->query($sql) or die("Couldn’t delete user #$id’s posts."); header('Location: b2team.php'); @@ -91,42 +91,41 @@ default:
ID | -Nickname | -Name | -URL | -Level | +ID | +Nickname | +Name | +URL | +Level | 3) { ?> -Login | +Login | ||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
".$user_data["ID"]." | \n"; - echo "".$user_data["user_nickname"]." | \n"; - echo "".$user_data["user_firstname"]." ".$user_data["user_lastname"]." | \n"; + $users = $wpdb->get_results("SELECT ID FROM $tableusers WHERE user_level>0 ORDER BY ID"); + foreach ($users as $user) { + $user_data = get_userdata($user->ID); + echo "|||||||||||
".$user_data->ID." | \n"; + echo "ID.")\">".$user_data->user_nickname." | \n"; + echo "".$user_data->user_firstname." ".$user_data->user_lastname." | \n"; echo ""; echo " | "; - if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + if (($user_data->user_url != "http://") and ($user_data->user_url != "")) echo " "; echo " | \n"; - echo "".$user_data["user_level"]; - if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1))) - echo " + "; - if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0)) - echo " - "; + echo " | ".$user_data->user_level; + if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1))) + echo " ID."&prom=up\">+ "; + if (($user_level >= 2) and ($user_level > $user_data->user_level) and ($user_data->user_level > 0)) + echo " ID."&prom=down\">- "; echo " | \n"; if ($user_level > 3) { - echo "".$user_data["user_login"]." | \n"; + echo "".$user_data->user_login." | \n"; } echo "
ID | -Nickname | -Name | -URL | -Level | +ID | +Nickname | +Name | +URL | +Level | 3) { ?> -Login | +Login | ||
".$user_data["ID"]." | \n"; - echo "".$user_data["user_nickname"]." | \n"; - echo "".$user_data["user_firstname"]." ".$user_data["user_lastname"]." | \n"; + foreach ($users as $user) { + $user_data = get_userdata($user->ID); + echo "|||||||||||
".$user_data->ID." | \n"; + echo "ID.")\">".$user_data->user_nickname." | \n"; + echo "".$user_data->user_firstname." ".$user_data->user_lastname." | \n"; echo ""; echo " | "; - if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + if (($user_data->user_url != "http://") and ($user_data->user_url != "")) echo " "; echo " | \n"; - echo "".$user_data["user_level"]; + echo " | ".$user_data->user_level; if ($user_level >= 2) - echo " + "; + echo " ID."&prom=up\">+ "; if ($user_level >= 3) - echo " X "; + echo " ID."\" style=\"color:red;font-weight:bold;\">X "; echo " | \n"; if ($user_level > 3) { - echo "".$user_data["user_login"]." | \n"; + echo "".$user_data->user_login." | \n"; } echo "