Not a developer? Go to MovableType.com

Plugin and Theme Directory

Comment Author Context v1.0

By Brad Choate
Posted April 21, 2009, in MT Tags, Templates, Widgets.

Details

Overview

In the context of a comment, all <$mt:AuthorSOMETHING$> function tags refer to the author of the entry or page where the comments were left. This default behavior in Movable Type (as of MT4.25) creates a situation where it is never possible to output author data for a commenter.

Description

The CommentAuthorContext plugin creates a block tag called <mt:CommentAuthorContext> in which <$mt:AuthorSOMETHING$> function tags will refer to the author of the comment.

Usage

  1. Create a "user" CustomField. We'll use <$mt:AuthorDataTwitter$> for this example.
  2. Place the <mt:CommentAuthorContext> block tag inside the <mt:Comments> tag block (typically in the entry or page detail template).
  3. Place your "user" CustomFields inside the <mt:CommentAuthorContext> tag block.

Final code might look something like this:

<mt:Comments>
    <mt:CommentAuthorContext>
        <a href="http://twitter.com/<$mt:AuthorDataTwitter$>/"><$mt:AuthorDataTwitter$></a>
    <mt:Else>
        I'm an anonymous commenter
    </mt:CommentAuthorContext>
</mt:Comments>

This could also be achieved without the plugin through this more processing intensive code:

<mt:Comments>
    <$mt:CommentAuthor setvar="display_name"$>
    <mt:Authors display_name="$display_name" need_entry="0" need_association="0">
        <a href="http://twitter.com/<$mt:AuthorDataTwitter$>/"><$mt:AuthorDataTwitter$></a>
    </mt:Authors>
</mt:Comments>

Compatibility

Movable Type versions: 4.35.05.15.26.0 Verified


Back

4 Comments

sizegenetics on June 14, 2012, 5:04 a.m. Reply

Very handy, i’m not really all that technical but managed to get this done so thanks!

mick on June 25, 2012, 8:17 a.m. Reply

Thanks for the marvelous posting!I have never read such a wonderful article and I am coming back tomorrow to continue reading. Christian Louboutin Online I feel fervently about this and I like learning about this subject.Enjoy yourself.

classified ads on July 16, 2012, 7:04 a.m. Reply

I’ve try It work well… Thank you!

Mark Carey

Mark Carey on February 11, 2015, 10:32 p.m. Reply

Download link broken, any one know of an alternate link?

Leave a Comment