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) »
  • Getting the PCP ID at any time during the contribution process
Pages: [1]

Author Topic: Getting the PCP ID at any time during the contribution process  (Read 1051 times)

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
Getting the PCP ID at any time during the contribution process
April 18, 2013, 12:47:07 pm
I have been trying to find a solution to this for some time, I feel like it's super simple I'm just missing something. A large part of our organizations fundraising is done through PCPs and I have been doing  some customizing. I was able to get the name of the owner of the PCP to show up on the PCP page, but only the first page, once you click make a donation it no longer shows up. I wrote a database call that utilizes the PCP ID to get the owners name inside the PCP>Page>PCPInfo.php file. This may not have been the best place for it, but it is where I was succesful. (I can not get the same function to run in my custom hooks file.

Code: [Select]
$ownerResult = mysql_query("
SELECT *
FROM   civicrm_pcp, civicrm_contact
WHERE  civicrm_pcp.contact_id = civicrm_contact.id
  AND  civicrm_pcp.id = {$this->_id}
");
$ownerFullName=mysql_result($ownerResult,0,"display_name");
$ownerFirstName=mysql_result($ownerResult,0,"first_name");
//$ownerName='test';
$this->assign('ownerFullName', $ownerFullName);
$this->assign('ownerFirstName', $ownerFirstName);

I'm wondering if there is a better, more consistent way to get the pcp Id, so that I may use it on all three of the contribution pages (main, confirm and thank you)? Im hoping whatever the solution maybe be I can also utilize the pcp Id in the contribution receipt!

Yashodha Chaku

  • Forum Godess / God
  • Ask me questions
  • *****
  • Posts: 755
  • Karma: 57
    • CiviCRM
Re: Getting the PCP ID at any time during the contribution process
April 18, 2013, 03:29:51 pm

pcp id /contact id is stored in $pcpInfo for PCP info page.

For contribution pages (main, confirm and thank you) you may wanna check $this->_pcpInfo for all pcp related info

HTH
-Yashodha
Found this reply helpful? Contribute NOW and help us improve CiviCRM with the Make it Happen! initiative.

RachelWright

  • I post occasionally
  • **
  • Posts: 78
  • Karma: 3
  • CiviCRM version: 4.2.7
  • CMS version: Joomla 2.5.17
  • MySQL version: 5.5.37
  • PHP version: 5.4.26
Re: Getting the PCP ID at any time during the contribution process
April 22, 2013, 12:32:06 pm
I was able to get the name to show up on all the pages by adding the same function and a line with

$page->assign('ownerFirstName', $ownerFirstName); //#rw

to both the main.php and the confirm.php files

Which was super helpful as I added the variable to my the email receipts!!

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Getting the PCP ID at any time during the contribution process

This forum was archived on 2017-11-26.