1) Find post.php under the wp-admin folder and find (around line 40)
switch ($action) {
Add the following right after that:
//---Added by LaughingLizard(http://weblogtoolscollection.com/)
case 'postbyfeeddemon':
$standalone = 1;
require_once('admin-header.php');
$post_pingback = intval($_GET['post_pingback']);
$content = balanceTags($_GET['content']);
$content = format_to_post($content);
$content = $content . "
...excerpt from: ".$_GET['post_link']."";
$excerpt = balanceTags($_GET['excerpt']);
$excerpt = format_to_post($excerpt);
$post_title = addslashes($_GET['post_title']);
$post_categories['0'] = intval($_GET['post_category']);
if(get_settings('use_geo_positions')) {
$latstr = $_GET['post_latf'];
$lonstr = $_GET['post_lonf'];
if((strlen($latstr) > 2) && (strlen($lonstr) > 2 ) ) {
$post_latf = floatval($_GET['post_latf']);
$post_lonf = floatval($_GET['post_lonf']);
}
}
$post_status = $_GET['post_status'];
$post_name = $_GET['post_name'];
if (empty($post_status)) $post_status = 'draft';
$comment_status = $_GET['comment_status'];
if (empty($comment_status)) $comment_status = get_settings('default_comment_status');
$ping_status = $_GET['ping_status'];
if (empty($ping_status)) $ping_status = get_settings('default_ping_status');
$post_password = addslashes(stripslashes($_GET['post_password']));
if (empty($post_name))
$post_name = sanitize_title($post_title);
else
$post_name = sanitize_title($post_name);
$trackback = $_GET['trackback_url'];
// Format trackbacks
$trackback = preg_replace('|\s+|', '\n', $trackback);
if ($user_level == 0)
die (__('Cheatin’ uh?'));
if (($user_level > 4) && (!empty($_POST['edit_date']))) {
$aa = $_POST['aa'];
$mm = $_POST['mm'];
$jj = $_POST['jj'];
$hh = $_POST['hh'];
$mn = $_POST['mn'];
$ss = $_POST['ss'];
$jj = ($jj > 31) ? 31 : $jj;
$hh = ($hh > 23) ? $hh - 24 : $hh;
$mn = ($mn > 59) ? $mn - 60 : $mn;
$ss = ($ss > 59) ? $ss - 60 : $ss;
$now = "$aa-$mm-$jj $hh:$mn:$ss";
$now_gmt = get_gmt_from_date("$aa-$mm-$jj $hh:$mn:$ss");
} else {
$now = current_time('mysql');
$now_gmt = current_time('mysql', 1);
}
// What to do based on which button they pressed
if ('' != $_POST['saveasdraft']) $post_status = 'draft';
if ('' != $_POST['saveasprivate']) $post_status = 'private';
if ('' != $_POST['publish']) $post_status = 'publish';
if ('' != $_POST['advanced']) $post_status = 'draft';
if((get_settings('use_geo_positions')) && (strlen($latstr) > 2) && (strlen($lonstr) > 2) ) {
$postquery ="INSERT INTO $tableposts
(ID, post_author, post_date, post_date_gmt, post_content, post_title, post_lat, post_lon, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt)
VALUES
('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', $post_latf, $post_lonf,'$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt')
";
} else {
$postquery ="INSERT INTO $tableposts
(ID, post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, post_modified, post_modified_gmt)
VALUES
('0', '$user_ID', '$now', '$now_gmt', '$content', '$post_title', '$excerpt', '$post_status', '$comment_status', '$ping_status', '$post_password', '$post_name', '$trackback', '$now', '$now_gmt')
";
}
$postquery =
$result = $wpdb->query($postquery);
$post_ID = $wpdb->get_var("SELECT ID FROM $tableposts ORDER BY ID DESC LIMIT 1");
if (!empty($_POST['mode'])) {
switch($_POST['mode']) {
case 'bookmarklet':
$location = 'bookmarklet.php?a=b';
break;
case 'sidebar':
$location = 'sidebar.php?a=b';
break;
default:
$location = 'post.php';
break;
}
} else {
$location = 'post.php';
}
if ( '' != $_POST['advanced'] || isset($_POST['save']) )
$location = "post.php?action=edit&post=$post_ID";
header("Location: $location"); // Send user on their way while we keep working
// Insert categories
// Check to make sure there is a category, if not just set it to some default
if (!$post_categories) $post_categories[] = 1;
foreach ($post_categories as $post_category) {
// Double check it's not there already
$exists = $wpdb->get_row("SELECT * FROM $tablepost2cat WHERE post_id = $post_ID AND category_id = $post_category");
if (!$exists && $result) {
$wpdb->query("
INSERT INTO $tablepost2cat
(post_id, category_id)
VALUES
($post_ID, $post_category)
");
}
}
add_meta($post_ID);
if (isset($sleep_after_edit) && $sleep_after_edit > 0) {
sleep($sleep_after_edit);
}
if ($post_status == 'publish') {
if((get_settings('use_geo_positions')) && ($post_latf != null) && ($post_lonf != null)) {
pingGeoUrl($post_ID);
}
if ($post_pingback) {
pingback($content, $post_ID);
}
do_action('publish_post', $post_ID);
// Time for trackbacks
$to_ping = $wpdb->get_var("SELECT to_ping FROM $tableposts WHERE ID = $post_ID");
$pinged = $wpdb->get_var("SELECT pinged FROM $tableposts WHERE ID = $post_ID");
$pinged = explode("\n", $pinged);
if ('' != $to_ping) {
if (strlen($excerpt) > 0) {
$the_excerpt = (strlen(strip_tags($excerpt)) > 255) ? substr(strip_tags($excerpt), 0, 252) . '...' : strip_tags($excerpt) ;
} else {
$the_excerpt = (strlen(strip_tags($content)) > 255) ? substr(strip_tags($content), 0, 252) . '...' : strip_tags($content);
}
$excerpt = stripslashes($the_excerpt);
$to_pings = explode("\n", $to_ping);
foreach ($to_pings as $tb_ping) {
$tb_ping = trim($tb_ping);
if (!in_array($tb_ping, $pinged)) {
trackback($tb_ping, stripslashes($post_title), $excerpt, $post_ID);
}
}
}
} // end if publish
exit();
break;
//---
2) Now in FeedDemon, go to Tools > Blog this News Item > Configure Blog Publishing Tools, then click Add. Put WordPress as the Name and enter the following into the Command Line:
http://my.domain.name/wordpress.folder/wp-admin/post.php?action=postbyfeeddemon&user_id=1&post_status=publish&comment_status=open&standalone=1&post_category=1&content=$ITEM_DESCRIPTION$&post_title=$ITEM_TITLE$&post_link=$ITEM_LINK$
Make sure you change the domain name and wordpress folders above before saving it...Voila!
Changes you can make to the above command:
- user_id=1 is the admin user, change it to anything you wish
- post_status=publish, you can change it to draft or private, your choice
- comment_status=open, could be closed by default
- post_category=1, this could be replaced by the number of a "news" or "links" category or something.
Peace.