Added check for user object to form submission. (#30)
This commit is contained in:
parent
6d10e0c054
commit
e3510fbf26
|
@ -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'];
|
||||||
|
|
Loading…
Reference in New Issue