Added check for user object to form submission. (#30)

This commit is contained in:
Christian Hanne 2016-07-25 17:06:35 +02:00 committed by Flavio Copes
parent 6d10e0c054
commit e3510fbf26
1 changed files with 6 additions and 4 deletions

View File

@ -174,10 +174,12 @@ class CommentsPlugin extends Plugin
$email = filter_var(urldecode($post['email']), FILTER_SANITIZE_STRING); $email = filter_var(urldecode($post['email']), FILTER_SANITIZE_STRING);
$title = filter_var(urldecode($post['title']), FILTER_SANITIZE_STRING); $title = filter_var(urldecode($post['title']), FILTER_SANITIZE_STRING);
$user = $this->grav['user']; if (isset($this->grav['user'])) {
if ($user->authenticated) { $user = $this->grav['user'];
$name = $user->fullname; if ($user->authenticated) {
$email = $user->email; $name = $user->fullname;
$email = $user->email;
}
} }
/** @var Language $language */ /** @var Language $language */