{"action":"created","issue":{"url":"https://api.github.com/repos/engram-design/Comments/issues/30","labels_url":"https://api.github.com/repos/engram-design/Comments/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/engram-design/Comments/issues/30/comments","events_url":"https://api.github.com/repos/engram-design/Comments/issues/30/events","html_url":"https://github.com/engram-design/Comments/issues/30","id":99193602,"number":30,"title":"Undefined property: stdClass::<property> when retrofitting comments field to existing entry without resaving","user":{"login":"alecritson","id":1488016,"avatar_url":"https://avatars.githubusercontent.com/u/1488016?v=3","gravatar_id":"","url":"https://api.github.com/users/alecritson","html_url":"https://github.com/alecritson","followers_url":"https://api.github.com/users/alecritson/followers","following_url":"https://api.github.com/users/alecritson/following{/other_user}","gists_url":"https://api.github.com/users/alecritson/gists{/gist_id}","starred_url":"https://api.github.com/users/alecritson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecritson/subscriptions","organizations_url":"https://api.github.com/users/alecritson/orgs","repos_url":"https://api.github.com/users/alecritson/repos","events_url":"https://api.github.com/users/alecritson/events{/privacy}","received_events_url":"https://api.github.com/users/alecritson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-05T12:27:46Z","updated_at":"2015-08-05T14:05:51Z","closed_at":null,"body":"Hey,\r\n\r\nThis plugin is exactly what I need with a project at the moment and its really awesome, so thanks!\r\n\r\nI ran into an issue though when installing this to an already existing site, heres how it goes:\r\n\r\n- I installed comments\r\n- Created `comments` a new field and attached it to a section\r\n- I go to my entry template and put the form code in\r\n- Submit a comment\r\n\r\nThen I got this error:\r\n\r\n```\r\nUndefined property: stdClass::$requireModeration\r\n```\r\nSo it looks like because I haven't saved the entry with the field, it doesn't have the required attributes set in order to do the checks. When I dump `$fieldSettings` it looks like this:\r\n\r\n```php\r\nstdClass#1\r\n(\r\n    [allowAnonymousGlobal] => ''\r\n    [requireModerationGlobal] => '1'\r\n    [commentsClosedGlobal] => ''\r\n    [userPermissionsGlobal] => array\r\n    (\r\n        '*' => '1'\r\n        1 => ''\r\n    )\r\n)\r\n```\r\n\r\nSo it has the globals in there but not the individual settings, since you only check for `$fieldSettings->requireModeration` not `$fieldSettings->requireModerationGlobal`, but because of the `Global` bit at the end, when you do the merge in `Comments_SettingsService.php` it doesn't match.\r\n\r\nI hope i'm making sense :)\r\n\r\nSo i've come up with a fix and will send a pull request if you are interested, or if you have a different solution thats fine too, but this worked for me and the plugin works without issue :)\r\n\r\nThanks again, this is awesome!\r\n"},"comment":{"url":"https://api.github.com/repos/engram-design/Comments/issues/comments/128009187","html_url":"https://github.com/engram-design/Comments/issues/30#issuecomment-128009187","issue_url":"https://api.github.com/repos/engram-design/Comments/issues/30","id":128009187,"user":{"login":"alecritson","id":1488016,"avatar_url":"https://avatars.githubusercontent.com/u/1488016?v=3","gravatar_id":"","url":"https://api.github.com/users/alecritson","html_url":"https://github.com/alecritson","followers_url":"https://api.github.com/users/alecritson/followers","following_url":"https://api.github.com/users/alecritson/following{/other_user}","gists_url":"https://api.github.com/users/alecritson/gists{/gist_id}","starred_url":"https://api.github.com/users/alecritson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alecritson/subscriptions","organizations_url":"https://api.github.com/users/alecritson/orgs","repos_url":"https://api.github.com/users/alecritson/repos","events_url":"https://api.github.com/users/alecritson/events{/privacy}","received_events_url":"https://api.github.com/users/alecritson/received_events","type":"User","site_admin":false},"created_at":"2015-08-05T14:05:51Z","updated_at":"2015-08-05T14:05:51Z","body":"Nice one! glad it helped out :smile:\r\n\r\nI quite like the way it is to be honest, I mean, when you add the field you get a list of global options for it which would cascade into all the entries, then you can fine tune them for each entry if you need to, seems like a nice way to do it.\r\n\r\nDid you have any ideas of how you wanted to do it?\r\n\r\nOff the top of my head, it could be cool to define \"rule sets\" in the comments settings and when you add a field you can either choose a ruleset or inputs it already comes with? That way you could have tons of elements using the same rulesets if needed but then also elements with their own. Changing a ruleset would cascade onto any fields with that set selected..... just a thought :smile:"}}