Item Comments macro

Release 1.1 - ...

The Item Comments smartlet allows users to leave comments on the site.

Usually you only need to include a call to the sml_itemcomments() smartlet without any parameters, and that's it. When you want users to be able to leave comments on every item of a specific contenttype, just make sure this contenttype uses a particular rendertemplate or translation and add the sml_itemcomments() call to it.

Example

The image below displays an example of Item Comments.

Item Comments example

When the user clicks the Add comment button a form will be displayed, as shown in the example below.

Add comment example

Of course, the Toggle moderation mode option will only be available if the currently logged on user has sufficient rights.

Parameters

The table below gives an overview of the available parameters for the Item Comments Smartlet.

Name Type Default Description
contentItem integer The current page Set contentItem if comments should be added to a different item than the currently rendering page.
newCommentStatus string WAITINGFORAPPROVAL Status code to be applied to newly added comments.
allowNested boolean true Determines if users can reply to other comments.
commentsClosed boolean false Determines if comments can be added to the page.
clipHierarchy integer 12 To avoid messy lay-out the indentation of replies can be clipped at a given level. Users can still reply, but the comment will not be indented further than its parent.
LatestComments integer 0 If set to a positive number, the smartlet will return a list of latest comments within the site, containing (at most) the given number of comments.
LatestCommentsForUser integer N/A If LatestComments is set, a user id can be passed to LatestCommentsForUser to get a list of comments posted by the given user.

ContentAccess

The following access type levels apply to ItemComments. Access only needs to be applied to the smartlet item itself. If your site requires different sets of rights for different parts of the site, copy the ItemComments folder and apply different Content Access to the copy.

Access Type Level Description
ForumPost Users can post comments, but the "newCommentStatus" will be applied to their comments.
ForumPostActive Users can post comments that are activated immediately.
ForumModerate Users can post, approve and disapprove comments.
ForumAdminister Users can post, moderate, edit and delete comments.

Technical details

The Item Comments Smartlet uses the ItemComments SXML macro internally, as well as several vipermethods from the itemcomments viper class.

Item comments are stored within the table swtItemComments.