Post to iLike from WordPress

Here’s another compter-nerd post for you artists who use both WordPress and iLike. If those words make no sense to you, you probably have a life, and have actually been outdoors in the past few days, and would never spend countless hours hunched over a laptop working on something called a “WordPress plugin.” You are excused. The rest of you, follow me.

I’ve been neglecting my iLike page because it’s such a hassle, but now that iLike is being favored by Google in search results, it seems like a good time to get that house in order. So I wrote a WordPress plugin that re-publishes blog posts to my iLike account.

Unlike the plugin I made for MySpace, this plugin will send your WP content to iLike automatically once it’s published. So you don’t have to remember to push a button.

Once the plugin is installed and activated, you can configure the plugin with your iLike info and options:

post-to-ilike-1

Once configured, post edit pages will display a status box:

post-to-ilike-2

That’s basically it.

Installation

  1. Make sure that your web host supports PHP with libcurl. Ask your hosting provider if you’re unsure about this.
  2. Download the plugin here
  3. Unzip it and toss the post-to-ilike.php file into your /wordpress/wp-content/plugins/ directory
  4. Log into WordPress, go to Plugins > Installed, find the “Post To iLike” plugin in the list and activate it.
  5. Now go to Settings > Post To iLike and configure your iLike login info and options.

Notes

  1. Not yet tested in WP 2.9
  2. iLike blogs support only a few HTML tags and no embedded media, so this plugin will strip out images, video embeds, etc. before posting. (a future version may convert these to optional off-site links.)
  3. This plugin version does no error checking on the iLike side. If your login info is wrong, or the attempt to publish fails, the plugin will simply quit silently. Your post may still be marked as published even if the attempt failed, so it’s a good idea to check your first few posts.
  4. Use at your own risk. No warranties, including those of merchantability or fitness for a particular purpose, are given or implied.

14 thoughts on “Post to iLike from WordPress”

  1. Brilliant work yet again Scott. I might actually start using all these social networking profiles I set up years ago now you’ve made these great plugins.

    I haven’t had chance to use this one yet but just so you know the MySpace one works fine in WordPress 2.9

  2. Got the Myspace one working great. iLike is being fussier, I’ve tried different both usernames (I log in with my email address and password, but there’s a username visible.) but nothing shows up on iLike.

    If I have “Allow previously published posts to be republished.” checked and switch the post to draft and re-publish, is it trying to publish to iLike again? (Making sure I’m testing right.)

  3. Hey Brad,

    Two things to look into:

    1) the plugin needs to write a cookie file to your server to store iLike session info, so the plugin directory needs to be writable. (You can easily hack the directory location in the plugin code.) If it can’t write the cookie, login probably won’t work and the plugin will probably fail silently.

    2) I *think* username and email address are one and the same, not really sure though. Make sure the “artist name” field is exactly as it shows up in your iLike page URL, sans any plus-signs (e.g. “Brad Sucks” not “Brad+Sucks”).

    If I have “Allow previously published posts to be republished.” checked and switch the post to draft and re-publish, is it trying to publish to iLike again?

    Yep, I did this so I could make post-publishing edits without reposting to iLike, but still have the option to repost if needed. You can also override this per-post by going into the Post Meta section of a post (it’s down somewhere beneath the Excerpt section) and setting the “x-post-ilike” attribute to 0.

    Let me know if you still have troubles.

  4. On second look: yeah, it should be email address, not username. If you’ve tried email and it still didn’t work, check the two points I mentioned above.

  5. Jammed a die() in there before the cookie deletion and saw two of these errors:

    Warning: curl_setopt(): Unable to access ilike-cookie-9516675

    A little bit of messing around hasn’t helped so I think curl might have problems writing to the server and it’s probably a uniquely my-server problem.

  6. Steve: Yay!

    Brad: Boo! Does your server have a /tmp or /var directory? You might have better luck writing the cookie file there.

    Maybe you can try hacking the plugin to write to a known file, instead of trying to create/delete a new file each time?

    Let me know if you get it working.

  7. Hei Scott,
    thanks a lot for this plugin! Unfortunately, I can’t get it to work. On two installs of WP 2.9.1 (on the same server) I only get this error message:

    “Fatal error: Call to undefined function curl_init() in /mnt/web7/11/91/5194091/htdocs/soundgenerators/wordpress/wp-content/plugins/post-to-ilike.php on line 72″

    Any idea what that means? The blog entry gets posted on the WP site, but not on iLike.

  8. Hey Florian, that probably means cURL isn’t enabled in your PHP config. You’ll either have to enable it, or ask your hosting provider if they can enable it for you.

    Some hosts don’t allow cURL by default. Sorry for the confusion. I’ll update the post to reflect this.

  9. Thanks for the info, Scott!
    And naturally, with my provider I can use cURL with the _next_ bigger hosting package than the one I recently upgraded to.. ah well. It’ll probably be worth it.

  10. Hey Scott.
    I’m having some difficulties with this plugin too.
    Sadly, I’m not that good at programming, so could you explain this part?:

    “the plugin needs to write a cookie file to your server to store iLike session info, so the plugin directory needs to be writable. (You can easily hack the directory location in the plugin code.)”

    What do I need to do to try this?

    Thanks.
    D.

  11. Hey David, sorry you’re having trouble with it.

    Do you have command-line access to your webserver? If so, you might want to try going into the wp-content directory and typing

    chmod 777 plugins

    There are also FTP programs that allow you to do this without the command-line.

    If that doesn’t work, you might have to ask your hosting provider for help. Every server is configured a little differently, and some stuff is restricted due to security reasons. So it’s best to ask your provider if you’re still stuck.

    Hope that helps!

Comments are closed.