Adding Minimum Donation Checking to Donations Cloud Plugin

Minimum donation fix

I’ve just redeployed the Donation Cloud plugin for WordPress by Alex Günsche on Visser Labs, it’s sitting in the right sidebar.

I made a note when I was last using Donations Cloud to add a minimum donation check to ensure that all donations are larger than the minimum specified in /wp-content/plugins/donationscloud/settings.php and consequently create a link in the link cloud. Here’s how I did it.

  1. Open up /wp-content/plugins/donationcloud/donationscloud/donationscloud.php with a text editor.
  2. Locate the function dc_checkform() on line #23
  3. Replace line #23 starting with function dc_checkform() { to line #29 ending with } below:
  4. Save changes and upload the modified file
function dc_checkform()
{
if (dc_get('pp_amount').value == '') { alert("<?php _e("Please enter a donation amount.", 'donationscloud') ?>"); return false; }
if (Number(dc_get('pp_amount').value) < '<?php echo DC_MIN_LINK_AMOUNT; ?>') { alert("Please enter a minimum donation amount of $<?php echo DC_MIN_LINK_AMOUNT; ?>.00."); return false; }
if (dc_get('pp_website').value == '' || dc_get('pp_website').value == 'http://') { alert("<?php _e("Please enter your website's URL.", 'donationscloud') ?>"); return false; }
if (dc_get('pp_linktext').value == '') { alert("<?php _e("Please enter a link text.", 'donationscloud') ?>"); return false; }
return true;
}

What this new line does is check the minimum link amount specified in settings.php against the amount that is about to be donated, if it is below the minimum value (e.g. $10.00) then a popup message notifies the generous visitor to increase their minimum donation. This code is now running on Visser Labs, try it out.

Leave a Comment

Before you comment - Do you have a support request? If so, this is not the right place to post it. Please submit support requests for Premium Plugins on the Support page and in the community Support Forums for free Plugins.

Your email address will not be published. Required fields are marked *