Eliminated race condition in user promotions
git-svn-id: http://svn.automattic.com/wordpress/trunk@667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
9a4221ee46
commit
1c8349669d
|
@ -111,9 +111,11 @@ case 'promote':
|
|||
}
|
||||
|
||||
if ('up' == $prom) {
|
||||
$sql="UPDATE $tableusers SET user_level=user_level+1 WHERE ID = $id";
|
||||
$new_level = $usertopromote_level + 1;
|
||||
$sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
|
||||
} elseif ('down' == $prom) {
|
||||
$sql="UPDATE $tableusers SET user_level=user_level-1 WHERE ID = $id";
|
||||
$new_level = $usertopromote_level - 1;
|
||||
$sql="UPDATE $tableusers SET user_level=$new_level WHERE ID = $id AND $new_level < $user_level";
|
||||
}
|
||||
$result = $wpdb->query($sql);
|
||||
|
||||
|
|
Loading…
Reference in New Issue