« tested in MT3 | Main | cheap and easy way to show "what links here" »

a clever workaround

For some reason, there seems to be a bug with dynamically-generated individual entry archives (using that method, rather than the dynamic publishing support in 3.1), in that the <MTEntryIfAllowComments>, <MTEntryIfCommentsOpen>, and <MTEntryIfAllowPings> tags don't seem to work - it doesn't seem like the correct status information is being pulled from the database. Thus, if you want to hide your comment posting form or link when comments are closed, this won't work on the dynamic individual archive pages. It will show even if the comments are closed or off.

Rather belatedly, I found a work around for this, using the Compare plugin and an obscure standard template tag <$MTEntryFlag$> which is mostly used for creating export files, to indicate what the comment and ping status is.

What I did is to make the following replacements:

For <MTEntryIfAllowComments> use <MTIfNotEqual a="[MTEntryFlag flag='allow_comments']" b="0">

For <MTEntryIfCommentsOpen> use <MTIfEqual a="[MTEntryFlag flag='allow_comments']" b="1">

For <MTEntryIfAllowPings> use <MTIfEqual a="[MTEntryFlag flag='allow_pings']" b="1">

There are three comment status flags. 0 means that comments are set to None, 1 means that comments are set to Open, and 2 means that comments are set to Closed. The first replacement checks whether the comment status is not set to 0, that is, whether it's set to 1 or 2. Either 1 or 2 means that comments are allowed, so that's how this replaces <MTEntryIfAllowComments>

The second replacement checks whether the comment status is set to 1, which means that comments must be open. That's how this replaces <MTEntryIfCommentsOpen>

There are two trackback status flags. 0 means that trackbacks are set to None and 1 means that trackbacks are Open. The third replacement therefore checks to see if the trackback status is set to 1. If so, trackbacks (pings) are allowed. That's how this replaces <MTEntryIfAllowPings>

Comments

Have you tried using the MT 3.x dynamic publishing? My quick experiment on that front was unsuccessful.

No, I haven't had time to look at that yet. At some point when I have some time I hope to do so.

The issue I was talking about here is limited to dynamic publishing on 2.661 using mt-view.cgi, which I'm using for the main blog. I actually did see the question come up at the MT support forums awhile back but otherwise I'm probably one of the few people who's actually using that method and needs this workaround tongue

About This Blog

  • Disclaimer: This is a personal site and is not connected with Six Apart, Ltd, the makers of Movable Type
  • Contact me:
  • Readme: What this blog is and is not
  • Reference: Templates for Al-Muhajabah's Islamic Blogs

February 2007

Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28      

Tips by Type

Tips by Area

Other ways to read this blog

Feed Subscribe to this blog's feed
(default is RSS 2.0, I also have RSS 1.0 and Atom)

Text-only version
Powered by
Movable Type 3.2