How does Movable Type know when you're logged in? I'd like to modify a friend's blog so that when he's logged in, a little edit button shows up next to each of his Movable Type posts so that he can go right to the MT interface to edit it. His static pages are parsed by PHP, so I can put programming in them. I just need to know how Movable Type knows he's logged in so I can mimic that.
Update: I poked around the source for some minutes, and after getting to some parts where it left cookies I figured I'd just take a look at what cookies Movable Type leaves around when you're logged in. I should have just done that in the first place.
I created a simple PHP script:
<?php
header("Content-type: text/plain");
print_r($_COOKIE);
?>
And once I discovered, like Dennis pointed out in a comment, that MT leaves a "user" cookie, I just added the following simple code to his main index template right after where his post title is displayed.
<?php
if(isset($_COOKIE['user'])){?>
<a href="/weblog/mt.cgi?__mode=view
&_type=entry&id=<$MTEntryID$>&blog_id=<$MTBlogID$>">(edit)</a>
<?php } ?>
It's really simple logic, and it doesn't test to see if you're really logged into Movable Type or whether there just happens to be a "user" cookie lying around. But, it's good enough, and if for some strange reason my simple code thinks he's logged in when he's not, the link will just go to the Movable Type login page and no harm done.
Note, I split up the URL above so that it doesn't bust out my page layout.
Update (4/13): Edited the title to better reflect its content.
Calif. Supreme Court to take up gay marriage ban
I would argue the point is notdefinitional. While the wordmarriage is su...
Justin: Nov 20, 4:37pm