Textpattern 4.0.4 includes improvements to some of the comment input form code. Most of the changes are internal improvements, but there are minor changes to behaviour in two cases, listed below.

None of these changes should affect the default template code distributed with Textpattern. In most cases you won’t notice any differences. There’s no need to change anything or understand the changes unless something is broken.

If you have created your own custom forms for displaying and submitting comments, you might notice two differences:

1. The position of the automatic comment preview

In older releases, the <txp:comments /> tag would automatically display a preview of the submitted comment, unless a <txp:comments_preview /> tag is explicitly used to position the preview elsewhere on a page.

In Textpattern 4.0.4, the automatic preview is displayed by the <txp:comments_form /> tag instead. Depending on your page layout, this might mean that the preview is displayed at the bottom of the article instead of the top. (A link anchor is used to position the user’s browser at the correct place on the page, wherever that might be).

The end result and user experience should be effectively the same in almost all cases.

2. The <txp:comments_form /> tag behavior

The preview attribute of the comments_form tag is no longer necessary. If your template code includes this attribute, you’ll see a warning message.

In older releases, the comments_form tag required some complex behaviour during a comment preview. In the new release, it is much simpler:

  • If the <txp:comments_form /> tag is used by itself, without a <txp:comments_preview /> tag, it will automatically display a preview of the submitted comment just before the comment input form.
  • If a <txp:comments_preview /> tag is included in your template or form code prior to the <txp:comments_form /> tag, comments_form will not display an automatic preview.
  • If your template or form code includes a <txp:comments_preview /> tag after the <txp:comments_form /> tag, both tags will display a preview of the submitted comment. You can prevent comments_form from displaying a duplicate using its show_preview attribute:

<txp:comments_form show_preview=0 />

Similarly, show_preview=1 will force the comments_form tag to always display an automatic preview, regardless of whether or not you’ve also used a comments_preview tag.