CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Personal Campaign Page donor list
Pages: [1]

Author Topic: Personal Campaign Page donor list  (Read 1748 times)

tcorbin

  • I’m new here
  • *
  • Posts: 5
  • Karma: 0
  • CiviCRM version: 3.2.5
  • CMS version: Drupal
  • MySQL version: ?
  • PHP version: ?
Personal Campaign Page donor list
May 31, 2011, 10:14:36 am
Is there a way for a Personal Campaign Page creator to see a list of all donors to his/her PCP? The PCP creator wants to acknowledge individual donors. Is there a way for them to view the donations received through their page or receive a notification when someone donates to their page? The honor roll feature is not sufficient because not all donors wish to be listed in the honor roll, and the PCP creator will also need each donor's address.

Hershel

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4640
  • Karma: 176
    • CiviHosting
  • CiviCRM version: Latest
  • CMS version: Mostly WordPress and Drupal
Re: Personal Campaign Page donor list
May 31, 2011, 11:36:59 am
Quote from: tcorbin on May 31, 2011, 10:14:36 am
Is there a way for them to view the donations received through their page 

Probably you could do this views, yes.

Quote from: tcorbin on May 31, 2011, 10:14:36 am
or receive a notification when someone donates to their page?

This could be coded in a small custom module, using CiviCRM hooks. Would require a programmer to do it.
CiviHosting and CiviOnline -- The CiviCRM hosting experts, since 2007

See here for the official: What to do if you think you've found a bug.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Personal Campaign Page donor list
May 31, 2011, 12:06:05 pm

We might be able to do the notification part via rules (and maybe a wee bit of custom code to find the PCP owner)

seems like both the below requests are very reasonable and would be great if we have a solution that other folks can also reuse

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

CiviTeacher.com

  • I live on this forum
  • *****
  • Posts: 1282
  • Karma: 118
    • CiviTeacher
  • CiviCRM version: 3.4 - 4.5
  • CMS version: Drupal 6&7, Wordpress
  • MySQL version: 5.1 - 5.5
  • PHP version: 5.2 - 5.4
Re: Personal Campaign Page donor list
July 29, 2011, 07:12:43 pm
I couldn't get Drupal Views to accomplish this task.  The selection of "currently logged in user" in conjunction with 'soft credits to the currently logged in user' just wasn't available in Views.

So we wrote own PHP code.   This code shows soft credits, not pcp contributions specifically, but if you expand the where clause and join the pcp table this should accomplish your goal of making it pcp specific.  Here it is for all to use.

How to use it.

1. You must configure your Drupal settings.php file to use dual databases if CiviCRM is installed in a separate database for you.  Look in the CiviCRM wiki for documentation on how to do this.  ]

2. Setup your module PHP filters and select that input type for a page or block

3. Copy and paste this code into the block.  You can edit the code and CSS as you see fit.  Adding fields or subtracting fields is easy if you know a little PHP and MySQL.  This just an example.

Code: [Select]
<style type="text/css">
.contributor-list td { padding: 8px 12px 8px 8px; }
.contributor-list tr.even { background: #FFF; }
.contributor-list tr.odd { background: #F3F9FF; }
</style>
<?php
global $user;

if (
$user->uid) {

db_set_active('civicrm');

$current_contact_id = db_query("SELECT civicrm_uf_match.contact_id FROM civicrm_uf_match WHERE civicrm_uf_match.uf_id = $user->uid");
while ($contact = db_fetch_object($current_contact_id)) {
  $contact_id = $contact->contact_id;
}

$soft_credits = db_query("
SELECT 
civicrm_contact.id AS civicrm_contact_id,
civicrm_contact.display_name AS civicrm_contact_display_name,
civicrm_contribution.receive_date AS civicrm_contribution_receive_date,
civicrm_contribution.total_amount AS civicrm_contribution_total_amount,
civicrm_address.street_address AS civicrm_address_street_address,
civicrm_address.city AS civicrm_address_city,
civicrm_state_province.abbreviation AS civicrm_state_province_abbreviation,
civicrm_address.postal_code AS civicrm_address_postal_code,
civicrm_contribution.source AS civicrm_contribution_source
 FROM civicrm_contribution civicrm_contribution 
 LEFT JOIN civicrm_contact civicrm_contact ON civicrm_contribution.contact_id = civicrm_contact.id
 LEFT JOIN civicrm_address civicrm_address ON civicrm_contact.id = civicrm_address.contact_id
 LEFT JOIN civicrm_contribution_soft civicrm_contribution_soft ON civicrm_contribution.id = civicrm_contribution_soft.contribution_id
 LEFT JOIN civicrm_state_province civicrm_state_province ON civicrm_address.state_province_id = civicrm_state_province.id
 WHERE (civicrm_contribution_soft.id IS NOT NULL) 
   AND (civicrm_contribution_soft.contact_id = "
. $contact_id . ")
   ORDER BY civicrm_contribution_receive_date DESC"
);

$contributor_list = "<table class='contributor-list'>";
$row_end = "</tr>";
$class = "odd";

while ($contribution = db_fetch_object($soft_credits)) {
  $class = ($class=='even') ? 'odd' : 'even';
  $contributor_list .= "<tr class='contributor ". $class ."'>";
  //$contributor_list .= "<td>" . $contribution->civicrm_contact_id . "</td>";
  $contributor_list .= "<td>" . $contribution->civicrm_contact_display_name . "</td>";
  $contributor_list .= "<td>" . substr($contribution->civicrm_contribution_receive_date,0,10) . "</td>";
  $contributor_list .= "<td>$" . $contribution->civicrm_contribution_total_amount . "</td>";
  //$contributor_list .= "<td>" . $contribution->civicrm_address_street_address . "</td>";
  $contributor_list .= "<td>" . $contribution->civicrm_address_city . "</td>";
  $contributor_list .= "<td>" . $contribution->civicrm_state_province_abbreviation . "</td>";
  $contributor_list .= "<td>" . $contribution->civicrm_address_postal_code . "</td>";
  $contributor_list .= "<td>" . $contribution->civicrm_contribution_source . "</td>";
  $contributor_list .= "</tr>";
}
$contributor_list .= "</table>";
print $contributor_list;
db_set_active('default');

}
?>


« Last Edit: July 29, 2011, 07:17:21 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

zesgar

  • I post occasionally
  • **
  • Posts: 107
  • Karma: 2
  • CiviCRM version: 4.3.4
  • CMS version: Joomla 2.5
Re: Personal Campaign Page donor list
January 09, 2012, 01:02:34 pm
Thanks for the code that looks great! Did you guys end up writing any code to email people?

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Personal Campaign Page donor list

This forum was archived on 2017-11-26.