Admin with "administer all guestbooks" and guestbook owners can delete all comments EXCEPT the very first comment that is created with the guestbook module.
This is because the first guestbook entry has an id of "0", but the delete code tests for id's greater than zero before deleting messages. To fix this, change the test for deleteentry > 0 to deleteentry >=0. So, the "delete a comment" code found around line 157 changes from:
// Delete a comment
//
$deleteentry = intval($_GET['guestbook_deleteentry']);
if ($deleteentry > 0
&& ( user_access("administer all guestbooks") || $uid == $user->uid )
&& $user->uid > 0) {
$result = db_query("DELETE FROM {guestbook} WHERE id = %d", $deleteentry);
}
To:
// Delete a comment
//
$deleteentry = intval($_GET['guestbook_deleteentry']);
if ($deleteentry >= 0
&& ( user_access("administer all guestbooks") || $uid == $user->uid )
&& $user->uid > 0) {
$result = db_query("DELETE FROM {guestbook} WHERE id = %d", $deleteentry);
}
Thanks!
Comments
Comment #1
hba commentedFixed, thanks.
Comment #2
(not verified) commented