Discussion and comments

Description

How to control commenting and discussion in Plone programmatically

Introduction

plone.app.discussion provides basic in-site discussion support.

Disqus is a popular external <iframe> embed service used for commenting.

More info

Content type support

Enable discussion in portal_types for each content typ It’s the Allow Discussion checkbox.

Discussion shows up as plone.comments viewlet in plone.app.layout.viewlets.interfaces.IBelowContent viewlet manager.

Getting total comment count

Example:

def getDiscussionCount(self):
    try:
        # plone.app.discussion.conversation object
        # fetched via IConversation adapter
        conversation = IConversation(self.targetContent)
    except:
        return 0

    return conversation.total_comments