Log username when deleting users
This commit is contained in:
parent
f6b6c3d335
commit
8c379c023e
@ -718,10 +718,12 @@ class UserPage extends Extension
|
|||||||
"You need to specify the account number to edit"
|
"You need to specify the account number to edit"
|
||||||
));
|
));
|
||||||
} else {
|
} else {
|
||||||
log_warning("user", "Deleting user #{$_POST['id']}");
|
$uid = int_escape($_POST['id']);
|
||||||
|
$duser = User::by_id($uid);
|
||||||
|
log_warning("user", "Deleting user #{$uid} (@{$duser->name})");
|
||||||
|
|
||||||
if ($with_images) {
|
if ($with_images) {
|
||||||
log_warning("user", "Deleting user #{$_POST['id']}'s uploads");
|
log_warning("user", "Deleting user #{$_POST['id']} (@{$duser->name})'s uploads");
|
||||||
$rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", ["owner_id" => $_POST['id']]);
|
$rows = $database->get_all("SELECT * FROM images WHERE owner_id = :owner_id", ["owner_id" => $_POST['id']]);
|
||||||
foreach ($rows as $key => $value) {
|
foreach ($rows as $key => $value) {
|
||||||
$image = Image::by_id($value['id']);
|
$image = Image::by_id($value['id']);
|
||||||
@ -737,7 +739,7 @@ class UserPage extends Extension
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($with_comments) {
|
if ($with_comments) {
|
||||||
log_warning("user", "Deleting user #{$_POST['id']}'s comments");
|
log_warning("user", "Deleting user #{$_POST['id']} (@{$duser->name})'s comments");
|
||||||
$database->execute("DELETE FROM comments WHERE owner_id = :owner_id", ["owner_id" => $_POST['id']]);
|
$database->execute("DELETE FROM comments WHERE owner_id = :owner_id", ["owner_id" => $_POST['id']]);
|
||||||
} else {
|
} else {
|
||||||
$database->execute(
|
$database->execute(
|
||||||
@ -746,7 +748,7 @@ class UserPage extends Extension
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
send_event(new UserDeletionEvent((int)$_POST['id']));
|
send_event(new UserDeletionEvent($uid));
|
||||||
|
|
||||||
$database->execute(
|
$database->execute(
|
||||||
"DELETE FROM users WHERE id = :id",
|
"DELETE FROM users WHERE id = :id",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user