Commit 1188ef33 authored by Clare Lenihan's avatar Clare Lenihan Committed by Clare Lenihan
Browse files

The first post in a topic can be deleted

parent ec3ad995
......@@ -50,10 +50,6 @@ if (!$info) {
throw new NotFoundException("Couldn't find post with id $postid");
}
if (!$info->parent) {
throw new NotFoundException("Cannot edit first post"); // TODO: replace with correct exception
}
$membership = user_can_access_group((int)$info->group);
$admin = (bool)($membership & GROUP_MEMBERSHIP_OWNER);
......@@ -64,14 +60,14 @@ if (!$moderator) {
throw new AccessDeniedException();
}
$postinfo = get_record_sql(
$post = get_record_sql(
'SELECT p.subject
FROM {interaction_forum_post} p
WHERE p.id = ?',
array($postid)
);
define('TITLE', get_string('deletepost', 'interaction.forum', $postinfo->subject));
define('TITLE', get_string('deletepost', 'interaction.forum', $post->subject));
require_once('pieforms/pieform.php');
......
......@@ -8,7 +8,7 @@
<p>{$post->body}</p>
{if $moderator || !$closed}<a href="{$WWWROOT}interaction/forum/editpost.php?parent={$post->id|escape}">{str tag="reply" section=interaction.forum}</a>{/if}
{if $moderator || $post->editor}<a href="{$WWWROOT}interaction/forum/editpost.php?id={$post->id|escape}"> {str tag="edit"}</a>{/if}
{if $moderator && $post->parent}<a href="{$WWWROOT}interaction/forum/deletepost.php?id={$post->id|escape}"> {str tag="delete"}</a>{/if}
{if $moderator}<a href="{$WWWROOT}interaction/forum/deletepost.php?id={$post->id|escape}"> {str tag="delete"}</a>{/if}
{if $post->edit}
<p>{str tag="edited" section="interaction.forum}</p>
<ul>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment