tips and tricks for movable type

edit link for comments
September 08, 2002

This one was inspired by David Gagne's tip on creating an edit link for your entries. I decided I wanted one for the comments on my blog too!

So I turned the comment date in my Comments Listing Template into a editing link.

Here's the code I used (key change in purple):

<a class="edit" target="_blank" title="edit" onmouseover="window.status='edit this comment (admin only)'; return true;" onmouseout="window.status=' '; return true;" href="<$MTCGIPath$>mt.cgi?__mode=view&_type=comment&id=<$MTCommentID$>&blog_id=
<$MTBlogID$>">
<MTCommentDate format="%b %e, %Y %I:%M %p"></a>

(Note there's not supposed to be a break before <MTCommentDate>; I just put one here for display purposes.)

Now, when I view the comments on my blog, I can click the comment date and edit away.

Thanks to Maddy for her tip on integrating the style of the link with CSS to make it less than obvious (found via the comments on this Posh post). No one knows it's there unless they hover!

Look at the comment dates here to see it in action.

Related Links:

edit link for entries with PHP
font tweaks and hiding links

Comments

That's brilliant! I've had to edit a few comments recently, and this would have made it so much quicker than getting to the entry and finding out which of the three comments by the same person was the problematice one! I already have the permalink to the comment on the individual archive page around the comment date, so I (again) wrapped the link code around the P in Posted. Now I have both toys! Thanks heaps. :)

by maddy | 09.09.02 01:50 AM

Thanks for this great tip!

On some (most) Bulletin board systems a visitor can also edit his own comments. That would also be a nice feature but probably only possible in combination with a visitors-login. (like PMachine?) But maybe with cookies this could also be done? If so it's a feature request for Ben I think.

Lawrence

by Quadsk8 | 09.09.02 04:50 AM

Nice trick…I may end up adopting it on my site.

Just a quick brainstorm, too. If you want to add a teense bit more CSS code to hide the link even more than it already is, add cursor: text; to your 'edit' class. Currently, while there's no text decoration to visually clue the link's existance, mousing over it changes the cursor to a hand. By setting the cursor to the 'text' cursor (the 'I-bar'), it will look exactly the same as when you're mousing over any other text.

Caveat: At least, it'll work on Windows boxes. I'm at work, not at home, so can't verify that cursor display behavior is the same on the Mac, and my brain's not kicking in enough for me to be sure. In any case, it's another idea….

by djwudi | 09.09.02 07:55 PM

Just following up on my earlier post — the cursor: text; declaration does display correctly on Macs (at least under IE 5.2.1 and Netscape 7.0) just as it does under Windows. With some slight modifications to your code, I've now got virtually invisible 'edit' links for my posts and comments — details can be found here, if you want.

by djwudi | 09.10.02 04:01 AM

Here's a little hack I came up with last night to allow inline editing of MT entries. It's messy, but it works!

<script>
c = document.cookie;
s1 = c.split('=');
s2 = unescape(s1[1]);
s3 = s2.split('::');
if (s3[0] == "<$MTEntryAuthor$>") {
document.write('<a href="<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>">[edit]</a>');
}
</script>

Just insert that anywhere within your <MTEntries> block and you should be good! It'd probably be safer to hide it within a .js file on your webserver and call the script using script src, but you get the idea.

Oh. I forgot to mention that if you blog resides somewhere other than <$MTCGIPath> (which mine does), you must manually edit the App.pm module to have MT set your login cookie to '/' as described here.

by jay | 11.14.03 01:13 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 5
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/78)

» Font tweaks and hiding links
Excerpt: Just on the off chance that anyone visits my site tonight (the evening of Sep. 9th, possibly into the morning of Sep. 10th), no, the site normally doesn't look quite this wonky. I'm working on adjusting my font stylesheet to be a bit more what I've got...
Weblog: The Long Letter
Tracked: 09.10.02 03:51 AM

» Super-secret spy editing
Excerpt: Girlie recently mentioned that she created an edit link for comments (with a neat CSS tip on how to make
Weblog: Live in the Delirious Cool
Tracked: 09.12.02 10:58 AM

» Edit link for comments
Excerpt: Yet another cool MT trick from the The Girlie Matters. This will create a link directly to the comments editing form. I don't really touch the comments unless someone submits something twice or forgets to close a tag, but I'm all for shortcuts. Besides...
Weblog: As deep as a puddle after a hard rain
Tracked: 01.23.03 10:00 PM

» Edit Posts Link!
Excerpt: Have you ever wanted to edit your post, but you dont want to go threw all the trouble of looking for the post? Well, thanks to this guy we can have a link that takes us directly to the post...
Weblog: Phoenix's Cave
Tracked: 05.24.03 10:33 AM

» The Magic Behind the Curtain
Excerpt: I just wanted one central place where I could record all the little dodads that make this site tick. Plugins MT Paginate MT Entry If Comments Global Listings MT Other Blog Smarty Pants Simple Comments Archive Date Header Word Count...
Weblog: Lunanina.com
Tracked: 08.10.03 01:13 AM