The MonkeyChow Reblog Publishing Platform

A recent query from a MonkeyChow user about reblogging got me to rethinking about how it is currently implemented in MonkeyChow. This is not the first time someone has asked me about automatically feeding a blog system like WordPress with the reblog/recycle feed from MonkeyChow (rss.php). I had previously looked into this back when WP was at v2.0 and rejected a WP plugin called WP-o-Matic because it really hosed my test blog, but this sounded like the ideal tool.

Fast forward to WP 2.2.2 and it seems like the plugin now works as advertised with WP! A blog without frequent posts usually drives people away. I originally wanted to use this type of a tool to boost my post frequency, since I do a lot of reading and make good use of the Recycle box for this site. But this is a quantity vs quality issue and I finally decided that high volume posting was not what I wanted. I find it annoying that some bloggers post minutia as new articles, rather than adding on to an existing article or post in their own comments. However, there are uses for such a tool.

So one of the things that was missing in the MonkeyChow reblog RSS feed was article bodies. That was added this morning to the rss.php. By combining WP with WP-o-Matic, and aiming at your MonkeyChow reblog feed, you can now have a reblog publishing platform. For any article in MonkeyChow where the Recycle box is checked, WP-o-Matic will automatically pick up the article and post it to WP. This can be seen in action at my test blog: http://www.swordcery.com. One of the problems I’m seeing is that there is no link back to the original article, so attribution is an issue.

For this site, I do a similar reblog action with the SimplePie WP plugin which automatically posts in the sidebar to the right.

Update: I found these instructions, which make use of the Get Custom Field Values plugin to make the titles work with proper link attribution. Note that this works for the entire blog, since the change replaces the original function, otherwise we would need to come up with some sort of conditional statement for making the title work with WP’s original the_permalink function, or this one.

To get the source link to work in the post, grab this plugin, install it and activate it.
Plugin Name: Get Custom Field Values
Version: 2.1
Plugin URI: http://www.coffee2code.com/wp-plugins/#getcustom

Then paste this code:
<?php echo c2c_get_custom(’wprss_link’); ?>
in the loop on your template index.

This code puts the source URL as the link for the post title. Example:

<h3 class=”storytitle” id=”post-<?php the_ID(); ?>”><a href=”<?php echo c2c_get_custom(’wprss_link’); ?>” rel=”bookmark”><?php the_title(); ?></a></h3>

Advertisements

26 thoughts on “The MonkeyChow Reblog Publishing Platform

  1. Nice site Ernie. I agree with you about the quality over quantity. Personally I have many people who reblog our site that never even asked. What can you do…

  2. on the tarball page I downloaded the oct 11 tar.gz for a clean install. I have mysql 4.1 and install.php failed. The manual said default CURRENT_TIMESTAMP was the default, and it was throwing an error, so I removed this and the update CURRENT_TIMESTAMP lines. Also, it seemed to throw an error when creating a tables with DEFAULT CHARSET so I changed it to ENGINE=MyISAM CHARACTER SET utf8 and it worked.

    Now, I’m on login.php and it says “Cookies not set”. The cookie path is wrong because I’m on a subdomain. so in config.php I added define(‘COOKIE_DIR’, ‘/’); and in fof-main.php I modified the setcookie to
    session_destroy(); // BF-CHANGED

    setcookie(“mc_info”,”$user_name::$user_password_hash”,$timestamp, COOKIE_DIR);

    the last line of install.php is missing a <?php before “setup complete”

    right now, I’m getting a db error, can’t find field image on feeds.php, working on it now

  3. also, install.php didn’t seem to (include the code to) create tables “item_tags”, “subscriptions”, “tags” which is , i believe, causing this db error

  4. Sorry for the install issues. Can you blow this all away and try again with the new tarball I just uploaded? The missing fields are due to the install stopping at the CURRENT_TIMESTAMP part. This means that the table exists (partially) when the installer goes over it again to check which tables need to be created, and it moves on to try the other tables. I also added the subscriptions table which was missing from the installer.

    I have some installer code coming soon which should do a better job of checking the lines it is trying to put into the database.

  5. dropped the tables and overwrote all the files (your sample config is missing the apos on the define COOKIE_DIR)

    still gave this error after successful install:
    Cannot query database. Have you run install.php? MySQL says: Unknown column ‘image’ in ‘field list’

    the only new table added is subscriptions. the tag tables in the the config aren’t added.

    the error is on the feeds.php page after login. i imagine it’s related to a function db call in fof-db.php but haven’t looked into it yet

  6. found the error. added $sql to the error output and discovered that most of the queries in init.php and fof-db.php called table names without the prefix. so, got that working.

    next problem: when adding a properly formed opml document, it couldn’t parse it (something the original fof, fofredux, and monkeychow were able to do) will look into it later

  7. Hmmm… that feed is certainly valid. Did you run the test at /monkeychow/simplepie/demo for the same feed? Be sure Monkeychow is using the built-in Simplepie install.

  8. the demo doesn’t work either, and the compatibility test shows I don’t have mbstring or iconv in my php install (I’m on godaddy). I didn’t do anything special to install it, was I supposed to? I did chmod the demo/cache to 777

  9. Both mbstring and iconv are required by Simplepie, which is the underlying engine that powers the RSS parsing. GoDaddy support should be able to accomodate. Once the compatibility test shows everything OK, you should be able to parse feeds and subscribe, etc.

  10. I’ve downloaded rpms: glibc-2.3.2-4.80.6.i386.rpm iconv-2.2.5-25.i386.rpm php-mbstring-4.3.8-1.1.i386.rpm and it seems I’d need to run proc_open to run the executalbes (I could add them in php.ini but I’ve tried that before and it didn’t seem to work). you can see my installation here: http://rss.benjaminfleischer.com/simplepie/compatibility_test/sp_compatibility_test.php

    any idea on how to install these? or should I put magpie back up there?

  11. If you have access to gcc and such tools, you should get the tar.gz versions, but otherwise I would recommend that you get the server host to install it for you or to give you the permissions to do so.

    At any rate, according to that page, you should be able to get some feeds working. Does anything work as far as subscribing to feeds?

  12. not sure how to gcc, connected to an ftp mirror and didn’t seem helpful. i don’t have a fancy enough godaddy account to have command line access or such. but I think I can use proc_open to do it

  13. Good work! Does that all work for you now?

    I’ll take a look to see if I can add any function checks to see if those iconv and mbstring aren’t there, but I think that is all in Simplepie itself.

  14. I also think there should be an option in the config to choose how feeds are sorted. I’d rather sort by i.e. dcdat in the items table. I edited this in init.php and it seems to work (though it is a text value, not date value).

    line 187 $result = fof_do_query(“select count( feed_id ) as count, dcdate, feed_id as id from “.FOF_DB_PREFIX.”feeds, “.FOF_DB_PREFIX.”items where “.FOF_DB_PREFIX.”feeds.id = “.FOF_DB_PREFIX.”items.feed_id and `read` is null order by “.FOF_DB_PREFIX.”feeds.dcdate desc”);

    line 352 $query .= ” order by dcdate desc $limit_clause”;

  15. Actually, since it’s something that is likely preferable per user, it should be configurable per user and should go into the prefs. I’ll see what I can whip up.

  16. I’m testing this now, I put this code in the parse_url function of simplepie.inc in the else statement. should get the timezone of feeds with a timezone stamp

    //get feed server timezone
    $record = file(‘http://api.hostip.info/get_html.php?ip=’
    . $rss_url.’&position=true’);

    $longitude = substr($record[3], 11);
    $offset = $longitude / 15;
    $date = gmmktime() + ($offset * 3600);
    $date = strtotime($date);

  17. oops, not quite, posted too soon. should compare server timezone to the offset and correct it should get server offset and compare to this offset

    $rss_url = ‘http://rss.benjaminfleischer.com/rss3.php’;
    $record = file(‘http://api.hostip.info/get_html.php?ip=’
    . $rss_url.’&position=true’);

    $longitude = substr($record[3], 11);
    echo $longitude;
    $feedoffset = $longitude / 15;
    $myoffset = date(“O”, time())/100;
    echo $feedoffset.”\n”;
    echo $myoffset.”\n”;
    $offset = $feedoffset – $myoffset;
    echo $offset.”\n”;
    $date = strtotime($date) – ($offset * 3600);

    echo date(“m-d-Y g:i.s”,$date);

    I think the code is right but that lookup thingie isn’t working right

  18. okay, last post for now. This is, I suppose, a bit of a hack. Maybe we can store these results for each feed or have them customizable (or both). Till then, this seems to work: (Place in parse_date function in simplepie.inc in the final else statement)

    $urlbits = parse_url($rss_url);
    //print_r($urlbits);
    $rss_url = $urlbits[‘host’];

    $rss_url = gethostbyname($rss_url);
    //echo “URL: “.$rss_url.””;
    $record = file(‘http://api.hostip.info/get_html.php?ip=’
    . $rss_url.’&position=true’);

    $longitude = substr($record[3], 11);
    //echo “Longitude: “.$longitude.””;
    $feedoffset = intval($longitude / 15);
    $myoffset = date(“O”, time())/100;
    //echo “Feed Offset: “.$feedoffset.””;
    //echo “My Offset: “.$myoffset.””;
    $offset = $feedoffset – $myoffset;
    //echo “Net Offset: “.$offset.””;
    //echo “Old Date “.date(“m-d-Y g:i.s”,strtotime($date)).””;
    $date = strtotime($date) + ($offset * 3600);

    //echo “New Date “.date(“m-d-Y g:i.s”,$date);

Comments are closed.