If you're a Flickr user, and want to post photos to your blog, you know there is no way to add categories or tags to the post. There could be a plug-in solution, but I couldn't find it. Seriously, I looked for a long time. If there is one that does what I'm proposing, please let me know and I will update this post and back out what I've done.
This solution isn't for the faint of heart. And I'm not 100% sure how secure it is. But I know for a fact it works just like I want. Here is the scenario and my hack:
1. Create a new WordPress user for Flickr posts. Doesn't matter what you call it. Just make sure it has posting rights.
2. Add you blog, or modify and existing entry, in your Flickr account. How to do this is beyond the scope of my explanation.
3. Use the new WordPress user you created in step one in your Flickr blog settings.
4. Modify you xmlrpc.php file that sits in your WordPress root folder, with the below code. It would be in the same place as wp-config.php.
Here is where it gets a little hairy. Find the line which has this code snippet. Mine starts on line 1578, but yours may differ. It's in the function mw_newPost($args):
if (is_array($catnames)) {
foreach ($catnames as $cat) {
$post_category[] = get_cat_ID($cat);
}
}
Just above the code on line 1578, add this code snippet:
if ( $user_login == '*NEW_USER_NAME*' ) {
$catnames[] = '*CATEGORY*';
$tags_input[] = '*TAG1*';
$tags_input[] = '*TAG2*';
}
Save the file. Flickr gives you the ability to create a test post. I would recommend you do that before calling it good. Make
SURE to remove any entries in the Settings/Writing/Update Services box before testing or your test post will show up in your RSS feed and anywhere else that you ping a new post.
Now, when you post from Flickr, using the correct WordPress user, you should have an entry in the category you choose, with the tags you want. You can add as many tags, or even categories as you like.
Again, there may be a more elegant solution that I haven't found, but for now this solves my problem. I suppose you could use this for any outside service that uses XMLRPC to post to your blog.
I'm also interested in hearing about potential security issues with this solution.
Photo courtesy of
poolie.
read more...