ezSQL update.
git-svn-id: http://svn.automattic.com/wordpress/trunk@127 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
beeb7bcd65
commit
b1e7828f4e
|
@ -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:
|
|||
<h3>Active users</h3>
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="tabletoprow">ID</td>
|
||||
<td class="tabletoprow">Nickname</td>
|
||||
<td class="tabletoprow">Name</td>
|
||||
<td class="tabletoprow">E-mail</td>
|
||||
<td class="tabletoprow">URL</td>
|
||||
<td class="tabletoprow">Level</td>
|
||||
<th>ID</th>
|
||||
<th>Nickname</th>
|
||||
<th>Name</th>
|
||||
<th>E-mail</th>
|
||||
<th>URL</th>
|
||||
<th>Level</th>
|
||||
<?php if ($user_level > 3) { ?>
|
||||
<td class="tabletoprow">Login</td>
|
||||
<th>Login</th>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
$request = "SELECT * FROM $tableusers WHERE user_level>0 ORDER BY ID";
|
||||
$result = mysql_query($request);
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
$user_data = get_userdata2($row->ID);
|
||||
echo "<tr>\n<!--".$user_data["user_login"]."-->\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 "<td $bg1>".$user_data["ID"]."</td>\n";
|
||||
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
|
||||
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\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 "<tr>\n<!--".$user_data->user_login."-->\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 "<td $bg1>".$user_data->ID."</td>\n";
|
||||
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data->ID.")\">".$user_data->user_nickname."</a></b></td>\n";
|
||||
echo "<td $bg1>".$user_data->user_firstname." ".$user_data->user_lastname."</td>\n";
|
||||
echo "<td $bg2> <a href=\"mailto:$email\" title=\"e-mail: $email\"><img src='../b2-img/email.gif' border=\"0\" alt=\"e-mail: $email\" /></a> </td>";
|
||||
echo "<td $bg1> ";
|
||||
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
|
||||
if (($user_data->user_url != "http://") and ($user_data->user_url != ""))
|
||||
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"../b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
|
||||
echo "</td>\n";
|
||||
echo "<td $bg2>".$user_data["user_level"];
|
||||
if (($user_level >= 2) and ($user_level > ($user_data["user_level"] + 1)))
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
|
||||
if (($user_level >= 2) and ($user_level > $user_data["user_level"]) and ($user_data["user_level"] > 0))
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=down\">-</a> ";
|
||||
echo "<td $bg2>".$user_data->user_level;
|
||||
if (($user_level >= 2) and ($user_level > ($user_data->user_level + 1)))
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data->ID."&prom=up\">+</a> ";
|
||||
if (($user_level >= 2) and ($user_level > $user_data->user_level) and ($user_data->user_level > 0))
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data->ID."&prom=down\">-</a> ";
|
||||
echo "</td>\n";
|
||||
if ($user_level > 3) {
|
||||
echo "<td $bg1>".$user_data["user_login"]."</td>\n";
|
||||
echo "<td $bg1>".$user_data->user_login."</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
@ -138,48 +137,47 @@ default:
|
|||
</div>
|
||||
|
||||
<?php
|
||||
$request = " SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID";
|
||||
$result = mysql_query($request);
|
||||
if (mysql_num_rows($result)) {
|
||||
$users = $wpdb->get_results("SELECT * FROM $tableusers WHERE user_level=0 ORDER BY ID");
|
||||
if ($users) {
|
||||
?>
|
||||
<div class="wrap">
|
||||
<h3>Inactive users (level 0)</h3>
|
||||
<table cellpadding="5" cellspacing="0">
|
||||
<tr>
|
||||
<td class="tabletoprow">ID</td>
|
||||
<td class="tabletoprow">Nickname</td>
|
||||
<td class="tabletoprow">Name</td>
|
||||
<td class="tabletoprow">E-mail</td>
|
||||
<td class="tabletoprow">URL</td>
|
||||
<td class="tabletoprow">Level</td>
|
||||
<td>ID</td>
|
||||
<td>Nickname</td>
|
||||
<td>Name</td>
|
||||
<td>E-mail</td>
|
||||
<td>URL</td>
|
||||
<td>Level</td>
|
||||
<?php if ($user_level > 3) { ?>
|
||||
<td class="tabletoprow">Login</td>
|
||||
<td>Login</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php
|
||||
while($row = mysql_fetch_object($result)) {
|
||||
$user_data = get_userdata2($row->ID);
|
||||
echo "<tr>\n<!--".$user_data["user_login"]."-->\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 "<td $bg1>".$user_data["ID"]."</td>\n";
|
||||
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data["ID"].")\">".$user_data["user_nickname"]."</a></b></td>\n";
|
||||
echo "<td $bg1>".$user_data["user_firstname"]." ".$user_data["user_lastname"]."</td>\n";
|
||||
foreach ($users as $user) {
|
||||
$user_data = get_userdata($user->ID);
|
||||
echo "<tr>\n<!--".$user_data->user_login."-->\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 "<td $bg1>".$user_data->ID."</td>\n";
|
||||
echo "<td $bg2><b><a href=\"javascript:profile(".$user_data->ID.")\">".$user_data->user_nickname."</a></b></td>\n";
|
||||
echo "<td $bg1>".$user_data->user_firstname." ".$user_data->user_lastname."</td>\n";
|
||||
echo "<td $bg1> <a href=\"mailto:".antispambot($email)."\" title=\"e-mail: ".antispambot($email)."\"><img src=\"../b2-img/email.gif\" border=\"0\" alt=\"e-mail: ".antispambot($email)."\" /></a> </td>";
|
||||
echo "<td $bg2> ";
|
||||
if (($user_data["user_url"] != "http://") and ($user_data["user_url"] != ""))
|
||||
if (($user_data->user_url != "http://") and ($user_data->user_url != ""))
|
||||
echo "<a href=\"$url\" target=\"_blank\" title=\"website: $url\"><img src=\"../b2-img/url.gif\" border=\"0\" alt=\"website: $url\" /></a> ";
|
||||
echo "</td>\n";
|
||||
echo "<td $bg1>".$user_data["user_level"];
|
||||
echo "<td $bg1>".$user_data->user_level;
|
||||
if ($user_level >= 2)
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data["ID"]."&prom=up\">+</a> ";
|
||||
echo " <a href=\"b2team.php?action=promote&id=".$user_data->ID."&prom=up\">+</a> ";
|
||||
if ($user_level >= 3)
|
||||
echo " <a href=\"b2team.php?action=delete&id=".$user_data["ID"]."\" style=\"color:red;font-weight:bold;\">X</a> ";
|
||||
echo " <a href=\"b2team.php?action=delete&id=".$user_data->ID."\" style=\"color:red;font-weight:bold;\">X</a> ";
|
||||
echo "</td>\n";
|
||||
if ($user_level > 3) {
|
||||
echo "<td $bg2>".$user_data["user_login"]."</td>\n";
|
||||
echo "<td $bg2>".$user_data->user_login."</td>\n";
|
||||
}
|
||||
echo "</tr>\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue