“deviant-thumbs” plugin"deviant-thumbs" plugin

November 9, 2009

When building this site, I thought I should add some color to it. And because I am a fan of DeviantArt, I looked for a way of showing several images from there in the sidebar.

I discovered, after some search, the plugin deviant-thumbs, which actually got updated to version 1.9.2. It works great – it uses the SimplePie engine included in WordPress, which caches the data, offers the possibility to add several widgets to the sidebar and… looks ok. The only thing that I couldn’t figure out why isn’t working is the search string – I wanted to show just my favs, so I used the search string “favby: myusername”. It didn’t take into account any search string – it was showing random images. The feed content is saved in the table “wp_options”, in the records with the option_name like “_transient_timeout_feed_mod_xxxxxxxx”, “_transient_timeout_feed_xxxxxxxx”, “_transient_feed_mod_xxxxxxxx” and “_transient_feed_xxxxxxxx”. These records can be deleted to empty the feed cache. If you delete all the records with these names, the cache for all feeds of the site will be emptied. When refreshing the page, if you use the widget, the cache will be rebuilt.

The issue was in the function “remote_get”, found in the file “deviant-thumbs.php”, around line 75. There, the url used included the search string, but it wasn’t url-encoded.

You should modify the line 73 so that it looks like this:

$url  = add_query_arg('q', urlencode($query), 'http://backend.deviantart.com/rss.xml?type=deviation');

Of course, when clicking on an image, a new window should be opened with the DeviantArt page, so that the user shouldn’t exit the current site. A small modification at line 110 in the same file solved the problem (I added “target=’_blank'”):

$thumbs[] = "<a title='$title' href='$link' target='_blank'><img src='$src' /></a>";

So now I can enjoy scribu’s “deviant-thumbs” plugin at its fullest!

Be Sociable, Share!

Leave a Reply




*