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) »
  • A way to display approved personal contribution pages?
Pages: [1]

Author Topic: A way to display approved personal contribution pages?  (Read 830 times)

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
A way to display approved personal contribution pages?
July 15, 2010, 11:29:10 am
I'm looking for a way to provide a list of approved personal contribution pages for contribution page X, in a list format.  I have noticed that CiviCRM profiles doesn't offer this functionality.  CiviCRM Views integration doesn't seem to either.

Unless I am missing something?  Please let me know.  Just checking.  thanks

Like so:
here is a list of all the personal contribution pages, please sponsor someone!
Team A
Team B
Johnny the 5k Walker
Sally Sponsor
Go Team Go
Marsha and her Mom
etc
etc



Otherwise we'll just copy and paste the personal contribution pages links or I will create some custom PHP code + query to display them.

FYI:
In civiCRM Views integration these are the only PCP fields available.
CiviCRM Soft Credits: Personal Campaign Page Nickname
CiviCRM Soft Credits: Personal Campaign Page Personal Note


« Last Edit: July 15, 2010, 11:33:51 am by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

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: A way to display approved personal contribution pages?
July 15, 2010, 07:12:00 pm
I decided to roll my own here.  If you are using Drupal, turn on PHP Filter in your modules if you haven't already.  Then, if Civi and Drupal run in separate databases... setup 'civicrm' in your Drupal settings.php file as a secondary database (keeping your Drupal database as the default).  that will allow you to paste in this code and use it on a Drupal node.

Code: [Select]
<?php
// displays a list of all the personal contribution pages that are approved

db_set_active('civicrm');
$res_teams = db_query("SELECT pcp.id, pcp.contact_id, pcp.title, pcp.intro_text, contact.display_name FROM {civicrm_pcp} pcp INNER JOIN {civicrm_contact} contact ON pcp.contact_id = contact.id WHERE pcp.is_active = 1 AND pcp.status_id = 2");
$pcplist = "";
while (
$team = db_fetch_object($res_teams)) {
  
$pcplist .= "<p>";
  
$pcplist .= "<a href=\"/civicrm/contribute/pcp/info?reset=1&id=";
  
$pcplist .= $team->id;
  
$pcplist .= "\" title=\"";
  
$pcplist .= $team->intro_text;
  
$pcplist .= "\">";
  
$pcplist .= $team->title;
  
$pcplist .= "</a>  (";
  
$pcplist .= $team->display_name;
  
$pcplist .= ")</p>";
  
$pcplist .= "\n";
}
print 
$pcplist;
db_set_active('default');
?>
« Last Edit: July 15, 2010, 07:19:27 pm by Stoob »
Try CiviTeacher: the online video tutorial CiviCRM learning library.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • A way to display approved personal contribution pages?

This forum was archived on 2017-11-26.