• Donate now or learn about donating.
  • This page lists all donors. Donation amounts exclude transaction fees charged by Paypal.

  • If you wish to edit your donor name, you may do so from your profile page.

  • ')); define('DONATION_DONOR_USER_DEFAULT_TEXT', t('If the user is registered on this site, enter his/her the Drupal uid.')); define('DONATION_TARGET_DEFAULT_TEXT', t('Donation to the Drupal Association')); define('DONATION_CURRENCY_DEFAULT_TEXT', t('The Drupal Association accepts payments in these two currencies.')); define('DONATION_LOVE_DEFAULT_TEXT', t('Drupal loves you. Enter the amount you wish to donate.')); function donation_perm() { return array('administer donations'); } function donation_menu($may_cache) { $items = array(); if ($may_cache) { $access = user_access('administer site configuration'); $items[] = array( 'path' => 'ipn/donation', 'callback' => 'donation_ipn', 'access' => TRUE, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'donation/thanks', 'title' => t('Thank you'), 'callback' => 'donation_thanks', 'access' => TRUE, 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'admin/settings/donations', 'title' => t('Donations'), 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_settings'), 'description' => t('Administer donations'), 'access' => $access, ); $items[] = array( 'path' => 'admin/build/donations', 'title' => t('Donations'), 'access' => $access, 'callback' => 'donation_admin', 'description' => t('Manages donations to your site via Paypal'), ); $items[] = array( 'path' => 'admin/build/donations/list', 'title' => t('List'), 'access' => $access, 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10, ); $items[] = array( 'path' => 'admin/build/donations/add', 'title' => t('Add donation'), 'access' => $access, 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_edit', 'add'), 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => 'admin/build/donations/edit', 'title' => t('Edit donation'), 'access' => $access, 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_edit', 'edit'), 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'admin/build/donations/delete', 'title' => t('Delete donation'), 'access' => $access, 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_edit', 'delete'), 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'admin/build/donations/import', 'title' => t('Import'), 'access' => $access, 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_import'), 'type' => MENU_LOCAL_TASK, ); $items[] = array( 'path' => 'donate', 'title' => t('Donate'), 'access' => TRUE, 'callback' => 'drupal_get_form', 'callback arguments' => array('donation_form_build'), 'type' => MENU_CALLBACK, ); $items[] = array( 'path' => 'donations', 'title' => t('Donations'), 'access' => TRUE, 'callback' => 'donation_public_page', 'type' => MENU_CALLBACK, ); } return $items; } function donation_settings() { $form[DONATION_EMAIL] = array( '#type' => 'textfield', '#title' => t('Donations email address'), '#default_value' => variable_get(DONATION_EMAIL, 'donations@drupal.org'), '#description' => t('Only donations to this email address are considered by this module.'), ); $form[DONATION_STATE] = array( '#type' => 'select', '#title' => t('Default donation state'), '#default_value' => variable_get(DONATION_STATE, DONATION_PUBLIC), '#options' => array( DONATION_PUBLIC => t('Public'), DONATION_HIDDEN => t('Hidden') ), '#description' => t('Select whether donations will be public or private for this site.'), ); $form[DONATION_DONOR_USER_TEXT] = array( '#type' => 'textarea', '#title' => t('Text for linking manual link of donation to user'), '#default_value' => variable_get(DONATION_DONOR_USER_TEXT, DONATION_DONOR_USER_DEFAULT_TEXT), '#description' => t('This text will be displayed from add the donation admin page.'), ); $form[DONATION_TARGET_TEXT] = array( '#type' => 'textarea', '#title' => t('Text describing the target organization'), '#default_value' => variable_get(DONATION_TARGET_TEXT, DONATION_TARGET_DEFAULT_TEXT), '#description' => t('This text will be displayed to the user from the main donate page.'), ); $form[DONATION_CURRENCY_TEXT] = array( '#type' => 'textarea', '#title' => t('Text for describing currency options'), '#default_value' => variable_get(DONATION_CURRENCY_TEXT, DONATION_CURRENCY_DEFAULT_TEXT), '#description' => t('This text will be displayed with choices of currency on main donation page.'), ); $form[DONATION_LOVE_TEXT] = array( '#type' => 'textarea', '#title' => t('Text for the we love donations section'), '#default_value' => variable_get(DONATION_LOVE_TEXT, DONATION_LOVE_DEFAULT_TEXT), '#description' => t('This text will be displayed on the main donation page.'), ); $currency_options_paypal_string = implode(',', array_keys(simple_paypal_get_currencies())); $form[DONATION_CURRENCY_OPTIONS] = array( '#type' => 'textarea', '#title' => t('Choose which currencies to accept'), '#default_value' => variable_get(DONATION_CURRENCY_OPTIONS, $currency_options_paypal_string), '#description' => t('This text will be displayed on the main donation page.'), ); $form[DONATION_DONORS_TEXT] = array( '#type' => 'textarea', '#title' => t('Text for the donors list page'), '#default_value' => variable_get(DONATION_DONORS_TEXT, DONATION_DONORS_DEFAULT_TEXT), '#description' => t('This text will be displayed at the top of the donors list page.'), ); $form[DONATION_THANKS_TEXT] = array( '#type' => 'textarea', '#title' => t('Text for the donations thank you page'), '#default_value' => variable_get(DONATION_THANKS_TEXT, DONATION_THANKS_DEFAULT_TEXT), '#description' => t('This text will be displayed to the user after they come back from Paypal.'), ); return system_settings_form($form); } function donation_edit($mode) { $timestamp = format_date(time(), 'custom', 'Y-m-d H:i O'); switch($mode) { case 'edit': case 'delete': $did = (int)arg(4); if ($did) { $result = db_query('SELECT * FROM {donations} WHERE did = %d', $did); $donation = db_fetch_object($result); $timestamp = format_date($donation->timestamp, 'custom', 'Y-m-d H:i O'); $uid = $donation->uid; } } $form['timestamp'] = array( '#type' => 'textfield', '#title' => t('Date'), '#default_value' => $timestamp, '#size' => 30, '#maxlength' => 30, '#description' => 'Format: Y-M-D H:M Z', ); $form['uid'] = array( '#type' => 'textfield', '#title' => t('User ID'), '#default_value' => $uid, '#description' => variable_get(DONATION_DONOR_USER_TEXT, DONATION_DONOR_USER_DEFAULT_TEXT), ); $form['name'] = array( '#type' => 'textfield', '#title' => t('Name of donor'), '#default_value' => $donation->name, '#size' => 60, '#maxlength' => 60, '#description' => t('The name of the person or the company who donated money.'), ); $form['address1'] = array( '#type' => 'textfield', '#title' => t('Address1 of donor'), '#default_value' => $donation->address1, '#size' => 60, '#maxlength' => 60, '#description' => t('The Address1 of the person or the company who donated money.'), ); $form['city'] = array( '#type' => 'textfield', '#title' => t('City of donor'), '#default_value' => $donation->city, '#size' => 60, '#maxlength' => 60, '#description' => t('The City of the person or the company who donated money.'), ); $form['state'] = array( '#type' => 'textfield', '#title' => t('State of donor'), '#default_value' => $donation->state, '#size' => 60, '#maxlength' => 60, '#description' => t('The State of the person or the company who donated money.'), ); $form['zip'] = array( '#type' => 'textfield', '#title' => t('Zip of donor'), '#default_value' => $donation->zip, '#size' => 60, '#maxlength' => 60, '#description' => t('The State of the person or the company who donated money.'), ); $form['phone'] = array( '#type' => 'textfield', '#title' => t('Home Phone Number of donor eg. 408-555-1234'), '#default_value' => $donation->phone, '#size' => 60, '#maxlength' => 60, '#description' => t('The Home Phone Number of the person or the company who donated money.'), ); $form['employer'] = array( '#type' => 'textfield', '#title' => t('Employer of donor'), '#default_value' => $donation->employer, '#size' => 60, '#maxlength' => 60, '#description' => t('The Employer of the person or the company who donated money.'), ); $form['occupation'] = array( '#type' => 'textfield', '#title' => t('Occupation of donor'), '#default_value' => $donation->occupation, '#size' => 60, '#maxlength' => 60, '#description' => t('The Home Phone Number of the person or the company who donated money.'), ); $form['mail'] = array( '#type' => 'textfield', '#title' => t('E-mail address of donor'), '#default_value' => $donation->mail, '#size' => 60, '#maxlength' => 60, '#description' => t('The e-mail address of the person or the company who donated money.'), ); $form['amount'] = array( '#type' => 'textfield', '#title' => t('Amount'), '#default_value' => $donation->amount, '#size' => 12, '#maxlength' => 12, '#description' => t('The amount of money donated, after subtracting transfer fees.'), ); $form['compliance'] = array( '#type' => 'checkbox', '#title' => t('Legal Compliance'), '#description' => t('** You MUST check this box to confirm that the following statements are TRUE and ACCURATE.

    1. I am a US citizen or a lawfully-permitted permanent resident.
    2. I am at least 16 years old.
    3. This contribution is not made from the general treasury funds of a corporation, labor organization or national bank.
    4. This contribution is not made from the funds of a political action committee.
    5. This contribution is not made from the treasury of an entity of person who is a federal contractor.
    6. This contribution is not made from the funds of an individual registered as a federal lobbyist or a foreign agent, or an entity that is a federally registered lobbying firm or foreign agent.
    7. The funds i am donating are not being provided to me by another person or entity for the purpose of making this contribution. '), '#default_value' => 0, '#required' => TRUE, '#name' => 'compliance', ); $form['currency'] = array( '#type' => 'select', '#title' => t('Currency'), '#default_value' => $donation->currency, '#options' => simple_paypal_get_currencies(), ); $form['status'] = array( '#type' => 'select', '#title' => t('Status'), '#default_value' => $donation->status, '#options' => array( DONATION_PUBLIC => t('Public'), DONATION_HIDDEN => t('Hidden') ), ); if ($mode == 'delete') { $form['delete'] = array( '#type' => 'submit', '#value' => t('Delete'), ); } else { $form['add'] = array( '#type' => 'submit', '#value' => t('Save'), ); } $form['mode'] = array( '#type' => 'hidden', '#value' => $mode, ); $form['did'] = array( '#type' => 'hidden', '#value' => $did, ); return($form); } function donation_edit_submit($form_id, $form = NULL) { $mode = $form['mode']; if ($form['delete'] == t('Delete')) { $mode = 'delete'; } switch($mode) { case 'add': db_query("INSERT INTO {donations} (timestamp, uid, name, address1, city, state, zip, phone, employer, occupation, mail, amount, compliance, currency, status) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", strtotime($form['timestamp']), $form['uid'], $form['name'], $form['address1'], $form['city'], $form['state'], $form['zip'], $form['phone'], $form['employer'], $form['occupation'], $form['mail'], $form['amount'], $form['compliance'], $form['currency'], $form['status']); drupal_set_message(t('The donation has been added.')); break; case 'edit': if ($form['did']) { db_query("UPDATE {donations} SET timestamp = %d, uid = %d, name = '%s', address1 = '%s', city = '%s', state = '%s', zip = '%s', phone = '%s', employer = '%s', occupation = '%s', mail = '%s', amount = %f, compliance = %s, currency = '%s', status = %d WHERE did = %d", strtotime($form['timestamp']), $form['uid'], $form['name'], $form['address1'], $form['city'], $form['state'], $form['zip'], $form['phone'], $form['employer'], $form['occupation'], $form['mail'], $form['amount'], $form['compliance'], $form['currency'], $form['status'], $form['did']); drupal_set_message(t('The donation has been updated.')); } break; case 'delete': if ($form['did']) { db_query("DELETE FROM {donations} WHERE did = %d", $form['did']); drupal_set_message(t('The donation has been deleted.')); } break; } drupal_goto('admin/build/donations'); } function donation_import($form = NULL) { $form = array( '#value' => t('Paypal lets you export your payment history to a CSV file. Copy/paste the contents of the file (or parts thereof) in the form below to mass import your Paypal history into Drupal. Note that the import routine does not check for duplicate entries.'), ); $form['data'] = array( '#type' => 'textarea', '#title' => t('Data'), '#default_value' => NULL, '#cols' => 70, '#rows' => 30, ); $form['import'] = array( '#type' => 'submit', '#value' => t('Import donations'), ); return $form; } function donation_import_submit($form_id, $form = NULL) { $lines = explode("\n", $form['data']); foreach ($lines as $line) { list($date, $time, $timezone, $name, $type, $status, $currency, $gross, $fee, $net, $from_email, $to_email, $tid, $cp_status, $shipping_address, $address_status, $item_title, $item_id, $sh_amount, $insurance_amount, $sales_tax, $opt_1_name, $opt_1_value, $opt_2_name, $opt_2_value, $auction_site, $buyer_id, $item_url, $closing_date, $escrow_id, $invoice_id, $ref_txn_id, $invoice_number, $custom_number, $receipt_id, $contact_phone_number ) = explode('","', $line); if ($to_email == variable_get(DONATION_EMAIL, 'donations@kotowskiforcampbell.org') && $name && $net) { // We need to swap the day and month in Paypal's date format: list($month, $day, $year) = explode('/', substr($date, 1), 3); $uid = donation_resolve_uid($mail); db_query("INSERT INTO {donations} (timestamp, uid, name, address1, city, state, zip, phone, employer, occupation, mail, amount, compliance, currency, status) VALUES (%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d)", strtotime("$month/$day/$year $time $timezone"), // date + time + timezone $uid, $name, $address1, $city, $state, $zip, $phone, $employer, $occupation, $from_email, (float)str_replace(',', '', $net), // net amount (gross - fee), commas stripped $compliance, $currency, variable_get(DONATION_STATE, DONATION_PUBLIC)); } } drupal_set_message(t('The donations have been imported.')); drupal_goto('admin/build/donations'); } function donation_resolve_uid($mail) { return (int)db_result(db_query("SELECT uid FROM {users} WHERE mail = '%s'", $mail)); } function donation_admin() { $rows = array(); $header = array( array('data' => t('Date'), 'field' => 'timestamp', 'sort' => 'desc'), array('data' => t('Name'), 'field' => 'name'), array('data' => t('Amount'), 'field' => 'amount'), array('data' => t('Status'), 'field' => 'status'), array('data' => t('Operations'), 'colspan' => '2') ); $sql = 'SELECT d.* FROM {donations} d' . tablesort_sql($header); $result = pager_query($sql, DONATION_PAGER, 0, NULL); while ($donation = db_fetch_object($result)) { $rows[] = array(format_date($donation->timestamp, 'small'), ($donation->uid ? theme('username', $donation) : check_plain($donation->name)), simple_paypal_format_amount($donation->amount, $donation->currency), ($donation->status == DONATION_PUBLIC ? t('public') : t('hidden')), "mail\">". t('mail') ."", l(t('edit'), "admin/build/donations/edit/$donation->did"), l(t('delete'), "admin/build/donations/delete/$donation->did"), ); } $output = theme('table', $header, $rows); $output .= theme('pager', NULL, DONATION_PAGER, 0); print theme('page', $output); } function donation_public_page() { $rows = array(); $header = array( array('data' => t('Name'), 'field' => 'name'), array('data' => t('Amount'), 'field' => 'amount'), array('data' => t('Date'), 'field' => 'timestamp', 'sort' => 'desc'), ); $sql = 'SELECT d.* FROM {donations} d WHERE d.status = %d' . tablesort_sql($header); $result = pager_query($sql, DONATION_PAGER, 0, NULL, DONATION_PUBLIC); while ($donation = db_fetch_object($result)) { if ($donation->uid) { $user = user_load(array('uid' => $donation->uid)); $name = theme('username', $user); } else { $name = $donation->name; } $rows[] = array( $name, simple_paypal_format_amount($donation->amount, $donation->currency), t('%time ago', array('%time' => format_interval(time() - $donation->timestamp, 1)))); } $output = variable_get(DONATION_DONORS_TEXT, DONATION_DONORS_DEFAULT_TEXT); $output .= theme('table', $header, $rows); $output .= theme('pager', NULL, DONATION_PAGER, 0); print theme('page', $output); } function donation_thanks () { print theme('page', variable_get(DONATION_THANKS_TEXT, DONATION_THANKS_DEFAULT_TEXT)); } function donation_ipn() { // Verify that the request came from Paypal, and not from some intrusion if (!simple_paypal_ipn_verify($_POST)) { // curl verification failed return; } if ($_POST['business'] != variable_get(DONATION_EMAIL, 'donations@drupal.org')) { // Payment is not for the email address configured return; } // Format the fields $name = check_plain($_POST['first_name'] .' '. $_POST['last_name'] . ($_POST['payer_business_name'] ? ' ('. $_POST['payer_business_name'] .')' : '')); $amount = check_plain((float)$_POST['mc_gross'] - (float)$_POST['mc_fee']); $timestamp = check_plain(strtotime($_POST['payment_date'])); $payer_email = check_plain($_POST['payer_email']); $currency = check_plain($_POST['mc_currency']); $uid = check_plain($_POST['custom']); $uid = $uid ? $uid : donation_resolve_uid($mail); // Record the donation in the database db_query("INSERT INTO {donations} (timestamp, uid, name, mail, amount, currency, status) VALUES (%d, %d, '%s', '%s', '%s', '%s', %d)", $timestamp, $uid, $name, $payer_email, $amount, $currency, variable_get(DONATION_STATE, DONATION_PUBLIC)); watchdog('donation', t('Donation from @name (@mail) amount of @amount @currency.', array( '@name' => $name, '@mail' => $payer_email, '@amount' => $amount, '@currency' => $currency, ))); } /** * Validate the donation page form submission. * * This function not needed, but functional (does process). * Could be used for additional validation checks. */ function donation_form_build_validate($form_id, $form_values) { /* if (!$form_values['cid']) { form_set_error('category', t('You must select a valid category.')); } */ if (!valid_email_address($form_values['mail'])) { form_set_error('mail', t('You must enter a valid e-mail address.')); } } /** * Process the site-wide contact page form submission. */ function donation_form_build_submit($form_id, $form_values) { /* Attempting to get this to send to Paypal after form validation. */ $form['#action'] = simple_paypal_get_url(); $form['submit'] = array( '#type' => 'hidden', '#value' => t('Proceed to paypal.com for payment'), '#name' => 'submit', ); return $form; } /** * Output this function in a PHP node when you want a form which points to Paypal. */ function donation_form() { return drupal_get_form('donation_form_build'); } function donation_form_build() { global $user; if (!$user->uid) { $form['body'] = array( '#value' => t('You do not need to register to donate. However, if you do, there will be a link to your user profile from the donors page. If you want that, then please login or register and then return back to this page.', array( '!login' => url('user/login', drupal_get_destination()), '!register' => url('user/register', drupal_get_destination()) )) ); } /* $form['#action'] = simple_paypal_get_url(); */ $form['pre'] = array( '#value' => '

    Please complete the form below and then you will be directed through the Paypal donation process.

    '); $form['business'] = array( '#type' => 'hidden', '#name' => 'business', '#value' => variable_get(DONATION_EMAIL, 'donations@drupal.org')); $form['cmd'] = array( '#type' => 'hidden', '#value' => '_xclick', '#name' => 'cmd'); $form['item_name'] = array( '#type' => 'hidden', '#value' => variable_get(DONATION_TARGET_TEXT, DONATION_TARGET_DEFAULT_TEXT), '#name' => 'item_name'); $form['no_shipping'] = array( '#type' => 'hidden', '#value' => 1, '#name' => 'no_shipping'); $form['return'] = array( '#type' => 'hidden', '#value' => url('donation/thanks', NULL, NULL, TRUE), '#name' => 'return'); // Create custom currency dropdown $currency_options_paypal_string = implode(',', array_keys(simple_paypal_get_currencies())); $currency_custom_options = explode(',', variable_get(DONATION_CURRENCY_OPTIONS, $currency_options_paypal_string)); foreach(simple_paypal_get_currencies() AS $key => $value) { if(in_array($key, $currency_custom_options)) { $custom_currency_list[$key] = $value; } } $form['currency_code'] = array( '#type' => 'select', '#title' => t('Currency'), '#options' => $custom_currency_list, '#name' => 'currency_code', '#description' => variable_get(DONATION_CURRENCY_TEXT, DONATION_CURRENCY_DEFAULT_TEXT), ); $form['address1'] = array( '#type' => 'textfield', '#title' => t('Address1'), '#description' => t('Enter the Address1 of the donor.'), '#size' => 60, '#required' => TRUE, '#maxlength' => 60, '#name' => 'address1' ); $form['city'] = array( '#type' => 'textfield', '#title' => t('City'), '#description' => t('Enter the city of the donor.'), '#size' => 60, '#required' => TRUE, '#maxlength' => 60, '#name' => 'city' ); $form['state'] = array( '#type' => 'textfield', '#title' => t('State'), '#description' => t('Enter the state of the donor. eg. CA'), '#size' => 60, '#default_value' => 'CA', '#required' => TRUE, '#maxlength' => 60, '#name' => 'state' ); $form['zip'] = array( '#type' => 'textfield', '#title' => t('Zip'), '#description' => t('Enter the zip of the donor. eg. 95008'), '#size' => 60, '#required' => TRUE, '#maxlength' => 60, '#name' => 'zip' ); $form['phone'] = array( '#type' => 'textfield', '#title' => t('Phone'), '#description' => t('Enter the phone of the donor eg. 408-555-1234'), '#size' => 60, '#required' => TRUE, '#maxlength' => 60, '#name' => 'phone' ); $form['employer'] = array( '#type' => 'textfield', '#title' => t('Employer'), '#description' => t('Enter the employer of the donor.'), '#size' => 40, '#required' => FALSE, '#maxlength' => 255, '#name' => 'employer' ); $form['occupation'] = array( '#type' => 'textfield', '#title' => t('Occupation'), '#description' => t('Enter the occupation of the donor.'), '#size' => 40, '#required' => FALSE, '#maxlength' => 255, '#name' => 'occupation' ); $form['mail'] = array( '#type' => 'textfield', '#title' => t('E-mail address of donor'), '#default_value' => $donation->mail, '#size' => 60, '#maxlength' => 60, '#required' => TRUE, '#description' => t('Enter e-mail address of the donor.'), ); $form['amount'] = array( '#type' => 'textfield', '#title' => t('Amount'), '#description' => variable_get(DONATION_LOVE_TEXT, DONATION_LOVE_DEFAULT_TEXT), '#size' => 40, '#required' => TRUE, '#needs_validation' => TRUE, '#maxlength' => 255, '#name' => 'amount', ); $form['compliance'] = array( '#type' => 'checkbox', '#title' => t('Legal Compliance'), '#description' => t('** You MUST check this box to confirm that the following statements are TRUE and ACCURATE.

    1. I am a US citizen or a lawfully-permitted permanent resident.
    2. I am at least 16 years old.
    3. This contribution is not is not made from the general treasury funds of a corporation, labor organization or national bank.
    4. This contribution is not make from the funds of a political action committee.
    5. This contribution is not made from the treasury of an entity of person who is a federal contractor.
    6. This contribution is not made from the funds of an individual registered as a federal lobbyist or a foreign agent, or an entity that is a federally registered lobbying firm or foreign agent.
    7. The funds i am donating are not being provided to me by another person or entity for the purpose of making this contribution. '), '#default_value' => 0, '#required' => TRUE, '#name' => 'compliance' ); $form['notify_url'] = array( '#type' => 'hidden', '#value' => url('ipn/donation', NULL, NULL, TRUE), '#name' => 'notify_url', ); $form['custom'] = array( '#type' => 'hidden', '#value' => $user->uid, '#name' => 'custom', ); $form['submit'] = array( /* '#type' => 'submit', */ '#type' => 'button', '#value' => t('Proceed to paypal.com for payment'), '#name' => 'submit', ); return $form; }