All pastes #942468 Raw Edit

Mine

public php v1 · immutable
·published 2008-03-14 15:19 UTC
rendered paste body
<?php/*Plugin Name: Write LatestDescription: Write the title, author and url of the latest post to a text file.Version: 0.1Author: zerodayAuthor URI: http://www.google.comPlugin URI: http://www.google.com*/define('LOC', '../latest.txt');function write_latest() {	ini_set('display_errors', 0);		global $wpdb;	$wpdb->hide_errors();	$result = $wpdb->get_results ('SELECT ID, post_title, post_author FROM ' . $wpdb->posts . ' WHERE post_status = "publish" ORDER BY ID DESC LIMIT 1');		if ($result) {			$title = $result[0] -> post_title;		$pid = $result[0] -> ID;		$aid = $result[0] -> post_author;				$url = get_permalink($pid);		}		$result = $wpdb->get_results ('SELECT display_name FROM '. $wpdb->users . ' WHERE ID = "' . $aid . '" LIMIT 1' );	if ($result) {			$author = $result[0]->display_name;	}		$stuff = "$title | $author | $url";			file_put_contents(LOC, $stuff);		ini_restore('display_errors');		}add_action('publish_post', 'write_latest');