{"action":"closed","issue":{"url":"https://api.github.com/repos/engram-design/Comments/issues/29","labels_url":"https://api.github.com/repos/engram-design/Comments/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/engram-design/Comments/issues/29/comments","events_url":"https://api.github.com/repos/engram-design/Comments/issues/29/events","html_url":"https://github.com/engram-design/Comments/issues/29","id":98999840,"number":29,"title":"Trying to get property of non-object $fieldSettings","user":{"login":"themccallister","id":5354908,"avatar_url":"https://avatars.githubusercontent.com/u/5354908?v=3","gravatar_id":"","url":"https://api.github.com/users/themccallister","html_url":"https://github.com/themccallister","followers_url":"https://api.github.com/users/themccallister/followers","following_url":"https://api.github.com/users/themccallister/following{/other_user}","gists_url":"https://api.github.com/users/themccallister/gists{/gist_id}","starred_url":"https://api.github.com/users/themccallister/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themccallister/subscriptions","organizations_url":"https://api.github.com/users/themccallister/orgs","repos_url":"https://api.github.com/users/themccallister/repos","events_url":"https://api.github.com/users/themccallister/events{/privacy}","received_events_url":"https://api.github.com/users/themccallister/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-04T15:46:00Z","updated_at":"2015-10-23T13:01:42Z","closed_at":"2015-10-23T13:01:42Z","body":"In `CommentsController > actionAdd` the following is returning null:\r\n\r\n`$fieldSettings = craft()->comments_settings->getFieldSettings(craft()->request->getPost('elementId'));`\r\n\r\nI did verify that the elementId is valid, I tried to wrap a conditional around the field settings for the controller like so:\r\n\r\n```php\r\n// check if field settings is null\r\nif (!is_null($fieldSettings)) {\r\n    // Set any new comment to be pending if requireModeration is true\r\n    if ($fieldSettings->requireModeration) {\r\n        $commentModel->status = Comments_CommentModel::PENDING;\r\n    }\r\n\r\n    // Protect against Anonymous submissions, if turned off\r\n    if (!$fieldSettings->allowAnonymous && !$commentModel->userId) {\r\n        craft()->comments->response($this, array('error' => 'Must be logged in to comment.'));\r\n    }\r\n} else {\r\n    $commentModel->status = Comments_CommentModel::APPROVED;\r\n}\r\n```\r\n\r\nThis does solve the problem, I'm not sure that its optimal or meets your goals for comment_settings."}}