Dashboard > blojsom > ... > Available Plugins > Comments
  blojsom Log In   View a printable version of the current page.  
  Comments
Added by David Czarnecki, last edited by David Czarnecki on May 19, 2006  (view change)
Labels: 
(None)

Comments

Comments allow visitors to your blog to leave comments on individual entries.

By default, comments are enabled in the individual user's blog.properties file that ships with blojsom.

As indicated in the installation documentation, the value for the blog-comments-enabled parameter can be either true or false. If set to true, blog comments are enabled globally on your blog. If set to false, no user may comment on blog entries.

The blog-comments-directory parameter indicates the directory where blog comments will be written to under the blog category directories. This directory is automatically added to the list of directories that get filtered by blojsom.

When users are taken to the comments page for a blog entry, they are presented with a form where they can enter their name, e-mail address, URL (for a homepage or their own blog), and a comment. Users must enter, at a minimum, their name and a comment. Their e-mail address and URL are optional.

Installation and Setup

The comment plugin is enabled by default for blojsom. You may skip this section.

In your global /WEB-INF/plugin.properties file, add the following line:

comment=org.blojsom.plugin.comment.CommentPlugin

You may then add "comment" to one of the flavor-based plugin chains. Typically this would only be done for your "html" flavor.

html.blojsom-plugin-chain=..., comment, ...

The comment plugin requires the SMTP server be defined in /WEB-INF/web.xml. The parameter is smtp-server. For example:

<init-param>
    <param-name>smtp-server</param-name>
    <param-value>localhost</param-value>
</init-param>

Using a JNDI context for mail settings

Available in blojsom 2.21 and above.

If the value for the smtp-server parameter starts with java:comp/env, then blojsom will try to lookup the JNDI context for the mail settings. Look at your application server documentation for information on setting a JNDI. As an example, the Tomcat JDNI resources HOW-TO has a section on JavaMail sessions. From their example, if using a JDNI mail session, your smtp-server parameter value would be java:comp/env/mail/Session.

Using SMTP server authentication credentials

Available in blojsom 2.21 and above.

You can also define authentication credentials for your SMTP server. These parameters are also defined in /WEB-INF/web.xml. The parameter names are smtp-server-username and smtp-server-password.

For example:

<init-param>
    <param-name>smtp-server-username</param-name>
    <param-value>username</param-value>
</init-param>
<init-param>
    <param-name>smtp-server-password</param-name>
    <param-value>password</param-value>
</init-param>

Disabling comments on individual entries

If comments are enabled on your blog, but you do not want to allow users to comment on an individual entry, you can do so by making that entry read-only. blojsom uses this to indicate whether or not it should allow users to comment on an entry. If a blog entry is writable, users may comment on that entry.

Comments can also be disabled on individual entries throug the web administration console. If you are adding or editing an entry, you can check a box to indicate that comments are not enabled on a single entry.

Finally, if you are running the Meta plugin before the Comments plugin, you can add metadata to the entry to disable comments. The metadata key to disable comments would be specified as "meta-blog-entry-comments-disabled=y" in your blog entry. You would do this if you were not editing your blog through the web administration console or you edit your blog entries from the command-line.

Automatically disabling comments on entries after a certain # of days

Comments can also be automatically disabled on entries after a certain number of days. If you login to the web administration console, you can set the number of days after which comments are no longer allowed on an entry. This setting is controlled by the plugin-comment-days-expiration parameter in an individual /WEB-INF/(blog-id)/blog.properties. As an example, the following will disable comments on entries after 5 days.

plugin-comment-days-expiration=5

Banning IP addresses from commenting

Starting with blojsom 1.9.1, both the Comment and Trackback plugins can ban IP addresses from posting comments and trackbacks by specifying regular expressions for banned IP addresses. The list of banned IP addresses is controlled by the blog-banned-ip-addresses parameter in an individual /WEB-INF/(blog-id)/blog.properties. As an example, the following will ban you from posting locally.

blog-banned-ip-addresses=127.0.0.1

Comment throttling

As of blojsom 2.11, you can configure comment throttling. If throttling is enabled, comments left from a particular IP address must wait a configurable number of minutes before another comment can be posted. The comment throttle parameter is controlled by the plugin-comment-throttle parameter in an individual /WEB-INF/(blog-id)/blog.properties. The parameter is specified as minutes.

plugin-comment-throttle=5

Configuring "Remember Me" cookie expiration

Expiration of the cookies for the "Remember Me" functionality in the comments plugin can be controlled by the plugin-comment-expiration-duration parameter in an individual /WEB-INF/(blog-id)/blog.properties. This parameter is specified as an integer value in number of seconds until expiration.

Enabling auto-formatting of comments

Add the following to your /WEB-INF/(blog-id)/blog.properties if you would like to enable auto-formatting of comments. This will turn all newline characters into <br/> tags.

plugin-comment-autoformat=true

Setting a prefix for comment e-mail messages

The default subject prefix for comment e-mails is set to [blojsom] Comment on: . If you would like to configure a different prefix for e-mail messages, set the plugin-comment-email-prefix property in an individual /WEB-INF/(blog-id)/blog.properties. For example:

plugin-comment-email-prefix=[your.blog.com] Comment:

Comment API support

As of blojsom 1.8, support for the Comment API has been added to blojsom.

Comment E-mail Templates

The comment plugin uses Velocity templates to create the text for the e-mail that gets sent to the author of an entry when a comment is made to that entry. There are two templates, org/blojsom/plugin/comment/comment-plugin-email-template-html.vm and org/blojsom/plugin/comment/comment-plugin-email-template-text.vm. The HTML template is used for the HTML portion of the e-mail message, while the text template is used for the text portion of the e-mail message for mail clients that cannot display HTML e-mail.

They are located inside the blojsom plugins JAR file in the blojsom web applications /WEB-INF/lib directory.

You can change the templates on a per-blog basis. Under your blog's templates directory, create the directory hierarchy, org/blojsom/plugin/comment/. Create either the comment-plugin-email-template-html.vm or comment-plugin-email-template-text.vm template file. You can use the original template files form the blojsom plugin JAR file as a basis for your new template.

The following table describes the objects available to the comment e-mail templates.

Variable Type Description
BLOJSOM_BLOG org.blojsom.blog.Blog Blog information.
BLOJSOM_USER org.blojsom.blog.BlogUser BlogUser information.
BLOJSOM_COMMENT_PLUGIN_BLOG_COMMENT org.blojsom.blog.BlogComment Comment.
BLOJSOM_COMMENT_PLUGIN_BLOG_ENTRY org.blojsom.blog.BlogEntry Entry.

Site running on a free Atlassian Confluence Open Source Project License granted to blojsom. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.5.4 Build:#809 Jun 12, 2007) - Bug/feature request - Contact Administrators