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,11 +174,13 @@ 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);
if (isset($this->grav['user'])) {
$user = $this->grav['user']; $user = $this->grav['user'];
if ($user->authenticated) { if ($user->authenticated) {
$name = $user->fullname; $name = $user->fullname;
$email = $user->email; $email = $user->email;
} }
}
/** @var Language $language */ /** @var Language $language */
$language = $this->grav['language']; $language = $this->grav['language'];