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:

Active users

- - - - - - + + + + + + 3) { ?> - + 0 ORDER BY ID"; - $result = mysql_query($request); - while($row = mysql_fetch_object($result)) { - $user_data = get_userdata2($row->ID); - echo "\n\n"; - $email = $user_data["user_email"]; - $url = $user_data["user_url"]; - $bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\""; - $bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\""; - echo "\n"; - echo "\n"; - echo "\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 "\n\n"; + $email = $user_data->user_email; + $url = $user_data->user_url; + $bg1 = ($user_data->user_login == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\""; + $bg2 = ($user_data->user_login == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\""; + echo "\n"; + echo "\n"; + echo "\n"; echo ""; echo "\n"; - echo "\n"; if ($user_level > 3) { - echo "\n"; + echo "\n"; } echo "\n"; } @@ -138,48 +137,47 @@ default: get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID"); + if ($users) { ?>

Inactive users (level 0)

IDNicknameNameE-mailURLLevelIDNicknameNameE-mailURLLevel LoginLogin
".$user_data["ID"]."".$user_data["user_nickname"]."".$user_data["user_firstname"]." ".$user_data["user_lastname"]."
".$user_data->ID."ID.")\">".$user_data->user_nickname."".$user_data->user_firstname." ".$user_data->user_lastname." \"e-mail:  "; - if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + if (($user_data->user_url != "http://") and ($user_data->user_url != "")) echo "\"website: "; 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 "".$user_data["user_login"]."".$user_data->user_login."
- - - - - - + + + + + + 3) { ?> - + ID); - echo "\n\n"; - $email = $user_data["user_email"]; - $url = $user_data["user_url"]; - $bg1 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\""; - $bg2 = ($user_data["user_login"] == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\""; - echo "\n"; - echo "\n"; - echo "\n"; + foreach ($users as $user) { + $user_data = get_userdata($user->ID); + echo "\n\n"; + $email = $user_data->user_email; + $url = $user_data->user_url; + $bg1 = ($user_data->user_login == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#dddddd\""; + $bg2 = ($user_data->user_login == $user_login) ? "style=\"background-image: url('../b2-img/b2button.gif');\"" : "bgcolor=\"#eeeeee\""; + echo "\n"; + echo "\n"; + echo "\n"; echo ""; echo "\n"; - echo "\n"; if ($user_level > 3) { - echo "\n"; + echo "\n"; } echo "\n"; }
IDNicknameNameE-mailURLLevelIDNicknameNameE-mailURLLevel LoginLogin
".$user_data["ID"]."".$user_data["user_nickname"]."".$user_data["user_firstname"]." ".$user_data["user_lastname"]."
".$user_data->ID."ID.")\">".$user_data->user_nickname."".$user_data->user_firstname." ".$user_data->user_lastname." \"e-mail:  "; - if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != "")) + if (($user_data->user_url != "http://") and ($user_data->user_url != "")) echo "\"website: "; 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 "".$user_data["user_login"]."".$user_data->user_login."