Making Yahoo Pipes feed work in wp-o-matic

Recently I was playing with wp-o-matic WordPress Plugin using a feed from Yahoo pipes. For the uninitiated, wp-o-matic is a WordPress Plugin which enables you to create new posts automatically from RSS or Atom feeds and Yahoo pipes is an interactive feed aggregator and manipulator.

After configuring everything, wp-o-matic kept on saying “0 posts fetched”, even though there were some posts in the feed generated by Yahoo pipes. After some research, I found out that I was not the only one facing this issue and there seems to be a bug in wp-o-matic which breaks feed urls having ampersand (&) character.

After digging into the code further, I found out the url is HTML encoded and stored in the database and is not decoded while retrieved. This occurs in the addCampaignFeed() function at line 1011 in the wpomatic.php file.

function addCampaignFeed($id, $feed)
{
    global $wpdb;
    $simplepie = $this->fetchFeed($feed, true);
    $url = $wpdb->escape($simplepie->subscribe_url());
    // code continues

In the above code, the function $simplepie->subscribe_url() returns the html encoded url. So to fix this, we have to pass the url to the htmlspecialchars_decode function. So to fix the bug we have to use the below code.

function addCampaignFeed($id, $feed)
{
    global $wpdb;
    $simplepie = $this->fetchFeed($feed, true);
    $url = $wpdb->escape(htmlspecialchars_decode($simplepie->subscribe_url()));
    // code continues

I have also notified the Plugin author about this and hopefully should be fixed soon, till then you can use the above code change if you are using feed from Yahoo pipes.

Related posts

Tags: , ,

18 Comments so far

Follow up comments through RSS Feed | Post a comment

3 Trackbacks/Pingbacks so far

Leave a Reply

Your email address will not be published. Required fields are marked *