Skip to content

Commit

Permalink
When deleting a post redirect to the previous post rather than the st…
Browse files Browse the repository at this point in the history
…art of the topic. Patch by François.
  • Loading branch information
reines committed Oct 1, 2010
1 parent 7574bda commit ba02891
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion delete.php
Expand Up @@ -67,7 +67,11 @@
delete_post($id, $cur_post['tid']);
update_forum($cur_post['fid']);

redirect('viewtopic.php?id='.$cur_post['tid'], $lang_delete['Post del redirect']);
// Redirect towards the previous post
$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$cur_post['tid'].' AND id < '.$id.' ORDER BY id DESC LIMIT 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
$post_id = $db->result($result);

redirect('viewtopic.php?pid='.$post_id.'#p'.$post_id, $lang_delete['Post del redirect']);
}
}

Expand Down

0 comments on commit ba02891

Please sign in to comment.