WP-Amazon for WP 2.1-2.2

Q&D EXPLANATION:

I modified an old (non-AJAX) version of Rich Manalang‘s WP-Amazon WordPress Plugin to work with WP2.1-2.2.

DISCLAIMER:

I didn’t write this plugin (that would be Rich Manalang in case you missed it above) and take no credit for creating it. I just modified it very, very slightly so that it will work with WordPress 2.1 and 2.2. I only grudgingly changed the author information and URI in the plugin so that people wouldn’t go and bother the already swamped Mr. Managlang with questions related to stupid mistakes I made in this version. Same reason for the different version number (ttb1.0, ttancm branch 1.0, clever huh =P Doesn’t really need a version number as such, since I really doubt I will ever update it beyond the current state. If you would like to make donations or anything of the sort, please direct them to Rich Manalang.

I know very little PHP (I tinker, not create) and I haven’t tested this beyond what I myself need it for, don’t plan to test for anything else, and can’t offer support of any kind.

Support includes stuff like: “this doesn’t work in so and so version of so and so browser”, “Could you add this/tweak that/change those/remove them”, “I tried your modified version of this plugin and WordPress actually physically exploded and took out half the data center where my server is, killing 15 people and more importantly losing all my website data!”, etc.

I take NO RESPONSIBILITY for any problems, and neither impose nor imply any responsibility on the part of the original plugin author, Rich Manalang for this shoddy, hacked up version of his plugin. In other words, USE AT YOUR OWN RISK! If something bad happens, I feel for you, but can’t do anything about it.


Now that that’s all out of the way =)

SLIGHTLY LONGER EXPLANATION:

This is just a very simply modified version of Version: 1.3.2 of Rich Manalang‘s WP-Amazon plugin.

This is the original version of the plugin I used and I was awed right from the beginning at how well it worked. It did exactly what it needed to, quickly, simply and well.

Mr. Manalang has released a newer version of the plugin, however it seems to have some problems with WordPress 2.1 and 2.2, and it has never worked with the non-visual WP editor (e.g. the only one I use =) and he has now decided to switch to a Greasemonkey script (which is a great idea I think, since it will make the plugin useable with any website, not just WP-powered ones), but hasn’t yet released it, and I needed a stopgap working plugin for the time being, without having to maintain a WP2.1 version install somewhere just to use the new version of the plugin with the visual editor on and copy and paste the code to whatever site I actually wanted the Amazon links on =P

INSTALLATION

From the original README file by Mr. Manalang

Installation
————
* Copy the following files to the appropriate locations:
/wp-content/plugins/
|
+- wp-amazon-plugin.php
+- wp-amazon.php

* Go to the WordPress plugins admin panel then activate the
WP-Amazon plugin.
* The post edit page should now have a button called “Amazon”
in the Quicktags region

Differences here are

  1. Remove any other version of WP-Amazon you have installed first.
  2. There is no quicktag button, but an “Insert content from Amazon” link at the bottom of the post box.
  3. For some weird reason I have not yet been able to figure out the link will not show up when first creating a new post. After you start the post you either have to hit the Save and Continue Editing button at the bottom, or else open a post from Manage->Posts->Edit for the link to show up. Don’t know why, doesn’t bother me that much, so I left it alone rather than risk breaking something else. =) UPDATE: Fix for this provided by Neetij. Version updated below.

NOTE (also known as Disclaimer part 2, the REVENGE!):

Some other caveats on using this hacky, hacky version of the plugin:

  • I have only tested it on Firefox 2.0.0.3. As mentioned above, I don’t plan on testing it in or modifying it to work in other browsers/versions.
  • I have tested it in WP 2.1 and 2.2 and only with the Non-WYSIWYG editor, and again I don’t plan on testing it in or modifying it to work in other versions.
  • I have tested it on PHP 5, again I don’t plan on testing it in or modifying it to work in other versions.
  • This is only intended as a stopgap measure until Mr. Manalang releases his new Greasemonkey script. I figured there might be people out there who would find it useful (since the lack of a working WP-Amazon is such a loss to the WP community) and so I released this version that I have been using. No updates, no support, no service. If it works, great! I’m glad to have been of some tiny service to you. If it doesn’t, I’m sorry, wish I could help, but I can’t.
  • I have been using this without problem or incident on several WP installs for awhile. Nothing has exploded yet, but your mileage may vary! Use at your own risk!
  • And did I mention the original plugin is by Rich Manalang?

DOWNLOAD

Grab the zip file here (ver. ttb1.1).

11 Comments

  1. Posted June 3, 2007 at 8:19 pm | Permalink

    I figured out why you need to save the post before seeing the ‘Insert’ link. And how to avoid it.

    In the add_link() function of the WP-Amazon class I modified the conditional statement to include a check for post-new.php. A new post uses ‘post-new.php’ while a saved/old post uses ‘post.php’.

    The updated code:
    if( (!strstr($_SERVER['PHP_SELF'], ‘post.php’)
    && !strstr($_SERVER['PHP_SELF'], ‘post-new.php’)
    && !strstr($_SERVER['PHP_SELF'], ‘page-new.php’))
    || $_GET["action"] == ‘editcomment’ )
    return 0;

    I’ve also posted this to the WP-Amazon Groups.
    Cheers.

  2. Posted June 4, 2007 at 9:15 am | Permalink

    Seems to work here too.

    I’ll update the download for people who don’t want to get any php on their hands.

    Cheers!

  3. miklb
    Posted June 22, 2007 at 6:33 am | Permalink

    Thanks again for updating this for newer versions, for some reason, in FF, it’s not opening in a new window, any suggestions on getting that function back?

  4. Posted June 22, 2007 at 8:44 am | Permalink

    Hmm, must have screwed something up when I added Neetij’s fix…

    I’ll try and take a peak at it in the next day or so (Japan time), if it’s not usable until then the link for the old version (have to save the post once before the amazon link shows up version) is:

    http://www.ttancm.com/mycrap/wpamazonttb10.zip

  5. Posted September 13, 2007 at 6:21 am | Permalink

    Hello!

    Can you change the name of your version of the plugin? I’d rather use yours (for the moment) than the other one and the two having the same name is giving the codex fits.

    Specifically, I use wp-plugin-tracker and it shows your plugin not being the latest.

    Thanks.

    Ciao!

  6. Posted September 13, 2007 at 8:59 pm | Permalink

    This isn’t a plugin I am actively developing or anything as I don’t have the time at the moment (I haven’t even updated this site for 3 months…) but if I understand correctly you just need a version with a different name so that the wp-plugin tracker will stop trying to get you to download a new version?

    I’m not familiar with the tracker plugin or how it works/where it gets it’s update info, but if it is something based just on the name I changed the name in the plugin in the version linked below.

    http://www.ttancm.com/mycrap/wpamazonttb12.zip

    There is still some php code in the plugin itself which searches for a new version at Rich Manalang’s site, but I don’t have the time to edit that out right now, so if that is what’s causing the problem, I’m afraid I can’t help (for the moment at least).

  7. Posted September 18, 2007 at 11:22 pm | Permalink

    You lost the Neetij fix in 1.2….but the concept was correct. I just manually made the same change to the 1.1 copy.

    Ciao!

  8. Posted September 19, 2007 at 1:35 pm | Permalink

    Yeah, that was kind of intentionally lost. It was causing problems on some installs for some reason (most likely a conflict with another plugin or something) so until I have a few minutes to figure out what it was I left it out. Hopefully have some actual free time this month (famous last words).

  9. Nancy
    Posted August 13, 2008 at 3:45 am | Permalink

    I installed this in wp v 2.6, but when I activated the plugin I got this error message:

    Warning: curl_setopt() [function.curl-setopt]: CURLOPT_FOLLOWLOCATION cannot be activated when in safe_mode or an open_basedir is set in /home/alist/public_html/wp-content/plugins/wp-amazon.php on line 73

    Could you let me know if this is a problem with my server? If not, any fix?

    Nancy

  10. Posted August 13, 2008 at 2:25 pm | Permalink

    The plugin is horribly outdated. I haven’t used it since wordpress 2.2, so I don’t even have a clue what has changed in the WP core since then that would require tweaking of the plugin, but since there have been a few major changes since then, including the new admin interface, I’d imagine the plugin probably needs to be rewritten.

  11. Posted August 13, 2008 at 2:28 pm | Permalink

    It seems someone else has updated/rewritten the plugin, so you might want to give their version a try. I’ve never used it, so I can’t speak to how well it works, but I’d imagine better than the version here =)

    http://wordpress.org/extend/plugins/amazon-reloaded-for-wordpress/

Post a Comment

No registration required!
Only your username and website are displayed publicly.
Your email is never displayed publicly, shared with any other site, or used for any purpose other than the administration of this website.


Required fields are marked *

*
*

Why?

preload for rolloverimage please ignore preload for rolloverimage please ignore preload for rolloverimage please ignore preload for rolloverimage please ignore preload for rolloverimage please ignore