- eJoneClicks.com - http://ejoneclicks.com -

PayPal Donate Plugin for WordPress

Posted By eJone On 14th June 2006 @ 00:52 In Click Tech | 40 Comments

PayPalDonatePluginThis is a plugin for WordPress that adds a small PayPal Donation form on your sidebar. It allows visitors of your site to make a donation or contribution via [1] PayPal, the most popular and largest online payment processing service. Some settings can be changed via the Options Page.

For a while now every (almost) technology blog I came across on the internet has the PayPal Donate button. Sometimes they are located on an article, but most of them they can be found on the sidebar. Obviously I didn’t want to be left out, so I went to seek the code for my own PayPal Donate button.

However, I thought WordPress had a plugin for almost everything and did a quick search. To my surprise, there weren’t any (if there are please let me know so I can correct this). The closest that I found was [2] Patrick Chia’s PayPal Donate Widget Plugin. I must thank him for his creating that plugin. Nonetheless, I’m not ready to play with Widgets yet, so I was still out of luck.

I thought to myself, how hard is it to create a plugin for WordPress? After looking at some sample codes and reading [3] some articles found on WordPress (watch out for this [4] cool video demonstration on creating your first plugin), I decided to give it a shot.

And so, the PayPal Donate Plugin for WordPress was born.

Installation is very straight-forward:

  1. extract the zip file into your wp-content/plugins/ folder
  2. activate it in your WordPress Plugins Dashboard
  3. enter your details in the Options page (make sure you do this!)
  4. insert code snippet to your sidebar.php

These settings are currently configurable on the Options page:

  1. PayPal E-mail Address
  2. Currency
  3. Donation Reference
  4. Return URL
  5. Cancelled URL
  6. Choice of buttons (the ones in use by PayPal)

Example code snippet:

<h2><?php _e('Tip Jar'); ?></h2>
<?php if (function_exists('ec_paypaldonate')) { ec_paypaldonate(); } ?>

This is my first ever WordPress plugin so please be gentle. The code is still a bit messy, but it definitely works on my installation of WordPress (v2.0.3). It still needs to be thoroughly tested so please don’t blame me if anything breaks! Testers, suggestions and comments are most welcome.

Please report any bugs and support questions in [5] this WordPress forum thread.

Oh, and if you happen to like my plugin, I wouldn’t mind a small donation as well. *cheeky-grin*

Download PayPal Donate Plugin for WordPress here:
[6] wp-paypal-donate-v0.3.zip (12kb)
[7] wp-paypal-donate-v0.2beta.zip (12kb)

Changelog:

  • 18 June 2006 (Version 0.3)

    • No longer beta.
    • Moved currency options from actual form to the Options page.
    • Remove 1.00 as an amount selection.
    • Removed Yen as a currency selection since 100 Yen works only to about 86 cents.
    • Improved Options page, now remembers button and currency selection.
    • Added credits to source code
  • 15 June 2006 (Version 0.2beta) - Now validates ok on [8] XHTML 1.0.
  • 14 June 2006 (Version 0.1beta) - First public Release.

Credits:


Article printed from eJoneClicks.com: http://ejoneclicks.com

URL to article: http://ejoneclicks.com/2006/06/14/paypal-donate-plugin-for-wordpress/

URLs in this post:
[1] PayPal: http://paypal.com
[2] Patrick Chia’s PayPal Donate Widget Plugin: http://blogates.com/patrick/2006/04/07/paypal-donate-widget-plugin/
[3] some articles found on WordPress: http://codex.wordpress.org/Writing_a_Plugin
[4] cool video demonstration on creating your first plugin: http://markjaquith.wordpress.com/2006/03/04/wp-tutorial-your-first-wp-plugin/
[5] this WordPress forum thread: http://wordpress.org/support/topic/76051
[6] wp-paypal-donate-v0.3.zip: http://ejoneclicks.com/wp/wp-content/uploads/2006/06/wp-paypal-donate-v0.3.zip
[7] wp-paypal-donate-v0.2beta.zip: http://ejoneclicks.com/wp/wp-content/uploads/2006/06/wp-paypal-donate-v0.2beta.z
ip

[8] XHTML: http://www.w3.org/MarkUp/
[9] http://blogates.com/patrick/2006/04/07/paypal-donate-widget-plugin/: http://blogates.com/patrick/2006/04/07/paypal-donate-widget-plugin/
[10] http://ryanduff.net/projects/wp-contactform/: http://ryanduff.net/projects/wp-contactform/

Click here to print.