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);
$title = filter_var(urldecode($post['title']), FILTER_SANITIZE_STRING);
$user = $this->grav['user'];
if ($user->authenticated) {
$name = $user->fullname;
$email = $user->email;
if (isset($this->grav['user'])) {
$user = $this->grav['user'];
if ($user->authenticated) {
$name = $user->fullname;
$email = $user->email;
}
}
/** @var Language $language */