public function checkForumPostDelete($user, $post) { $prefix = 'forum.post.delete.'; $this->ensureLoggedIn($user); $this->ensureCleanRecord($user); if ($user->isGMT()) { return 'ok'; } if (!$this->doCheckUser($user, 'ForumView', $post->topic->forum)->can()) { return $prefix . 'no_forum_access'; } if ($post->poster_id !== $user->user_id) { return $prefix . 'not_owner'; } if ($post->topic->isLocked()) { return $prefix . 'locked'; } $position = $post->postPosition; $topicPostsCount = $post->topic->postsCount(); if ($position !== $topicPostsCount) { return $prefix . 'only_last_post'; } return 'ok'; }