With the comment module, one needs the administer comments permission to be able to change the disabled/read-only/read-write setting for comments on a particular node. This patch adds a permission to override this for specific node types.
I find this feature particularly interesting in conjunction with Organic Groups (OG), because it allows group administrators to edit the comment settings for posts in their groups (posts they can edit).
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | override_node_options-comment-settings-826522-10.patch | 1.24 KB | Softwar |
Comments
Comment #1
anrikun commentedVery nice patch!
I have just updated the new permission name so that it becomes:
override NODE_TYPE comment settings option
Just to respect module's permissions naming conventions :-)
Comment #2
David Lesieur commentedI'm not sure how good "settings option" sounds, but I don't mind the change. :)
Comment #3
anrikun commentedIt's up to maintainers to decide.
Anyway, I hope one of these 2 patches get committed soon!
Comment #4
timmillwoodI have just committed this to the 6.x-1.11 release.
(Will patch D5 and D7 versions this week)
Comment #5
dave reidThis should likely be using a bit-wise boolean operation instead of re-assigning #access since comment.module already assigns $form['comment_settings']['#access'] = user_access('administer comments'). So in the case the user has that base permission but not the override permission, their fieldset will go missing, when it should still be visible.
So in summary, the third line in the above code be:
Comment #6
David Lesieur commentedGiven that the condition
!user_access('administer comments')is checked before replacing$form['comment_settings']['#access'], the use of the bit-wise assignment does not seem necessary. However, we could use the bit-wise assignment and remove the condition.Comment #7
dave reidAh, hah I missed that condition, but I think we can just simplify it with an OR anyway. That's how we're currently using it. If a user does not have the 'override comment options' permission but does have some other permission or module that shows this setting it shouldn't clobber it; cooperation and not competition.
Comment #8
David Lesieur commentedFully agree. Here's a patch!
Comment #9
mariusz.slonina commentedHi, This is the patch for the D7 release - I've simply rewritten patches above for D7-dev
Comment #11
fuerst commented#9 works for 7.x-1.12
Comment #12
David Lesieur commentedComment #13
Softwar commentedHello,
I've used the last patch in comment #9 and I've solved a problem. If you apply this patch, sometimes this patch doesn't work because form comment settings is called before the others forms (for example before publishing options).
The solution is to modify call order of form with hook_module_implements_alter like that :
After that, this patch is called normally.
Best regards.
Softwar
Comment #14
opdaviesThe patch is #9 doesn't apply to the latest 7.x-1.x version of ONO, so it will need re-rolling.
Comment #15
opdaviesComment #16
Softwar commentedHi,
I've created a patch to apply modifications in comment #9 in order to answer at comment #15.
Enjoy.
Comment #17
Softwar commentedComment #22
opdaviesComment #23
opdaviesThe patch in #16 works, although the module weight needs to be adjusted in order for it to do so.
As per #1090696: Reduce module weight, the default module weight is set to
-1so that it does not interfere with Date Popup Authored module, but I think if it's blocking ONO's core functionality, it should be set back and people can adjust module weights as per their own requirements.Comment #25
opdaviesThe patch in #16 has been committed, along with some whitespace clean-up, and the module weight amendments.
Comment #26
opdaviesI've added a new issue, #2561447: Add tests for comment settings, to add tests for this new option.