Per-subsite discussion settings with lineage

I have one Plone (4.3.8) site with three collective.lineage subsites. The three subsites are distinct blogs, and use Scrawl for the Blog Entry content type, which is AT-based.

My issue is that only one of the subsites should have discussions/commenting enabled, while the main site and the other two subsites should not allow comments. It seems that the only setting that can change between subsites is the theme, while everything else is global and applies everywhere.

Is there any way to achieve this?

I can think of three possibilities:

  1. Just hide the comment form with CSS. Security is not a concern in this case, so I might go this route.
  2. Suppress it with Diazo, but the theme is a traditional portal-skins based one, plus it's no more secure than #1.
  3. Create a clone of the "Blog Entry" type in portal_types, then allow this clone type to accept comments, and disable comments on the original type, and only allow the clone type in the first subsite, only original type in other two subsites. Is this insane?

You can override ConversationView sticked to your own layer and implement the enabled method as you need.

Thanks! I went with lineage.registry instead, and this external script:

from plone.protect.interfaces import IDisableCSRFProtection
from plone.registry.field import Bool
from plone.registry.interfaces import IRegistry
from plone.registry import Record
from zope.component.hooks import setSite
from zope.component import getUtility
from zope.interface import alsoProvides

FIELDNAME = 'plone.app.discussion.interfaces.IDiscussionSettings.globally_enabled'

def enable_comments(self):
  alsoProvides(self.REQUEST, IDisableCSRFProtection)
  setSite(self['sub-site-id'])
  sub_registry = getUtility(IRegistry)
  sub_registry.records[FIELDNAME] = Record(Bool(), True)
  value = sub_registry.records[FIELDNAME].value
  print value

@fulv personally I don't think there is much advantage of subsites vs just multiple sites per instance. It's easy enough to share a theme between them. With LDAP or something similar it would be easy to share users. Memory usage might be a little higher but does it matter?

In this client's case, we decided to go exactly the opposite way, namely from multiple sites to subsites. The big advantages of doing this are:

  • Searchability: all subsites' content can be searched from anywhere out of the box
  • "Linkability": as a consequence of searchability, in TinyMCE it's super easy to create links to content in the subsites
  • Syndication: for example, the main site's homepage can have a collection pulling updates from the subsites. They used to have to manually copy and paste static blurbs, so this is a huge time-saver.
3 Likes