Here's how I add an edit link that shows up only for authors. First, go to manage templates and set the output file for your main index to index.php. Then, goto weblog config and set the default extension for archives as php.
In your templates you add the following code wherever you want your edit link:
<?php
if(isset($_COOKIE['user'])) {
echo " | <a href=\"<$MTCGIPath$>mt.cgi?__mode=view&_type=entry&id=<$MTEntryID$>&
blog_id=<$MTBlogID$>\" target=\"_blank\">Edit";
}
?>
How it works:
When you log into MT, it sets a cookie called user that saves your login information. The PHP code checks for the set cookie. If someone is able to hack a forged cookie, the link will still fail to work because the password is wrong.
Comments