So I've almost got a hook working to add the name of the contribution page to the main.tpl part of a PCP.
This is what I have so far:
function wordpress_civicrm_buildForm($formName, &$form) {
if ( $formName == 'CRM_Contribute_Form_Contribution_Main' ) {
$ctid = $form->getVar('_contributionPageID');
$cpagequery = mysql_query("
SELECT *
FROM civicrm_contribution_page
WHERE civicrm_contribution_page.id = $ctid
");
while ($cnamerow = mysql_fetch_array($cpagequery)){
$cPageName = $cnamerow['title'];
}
$form->assign('cPageName', $cPageName);
}
}
The part that's not working is using the $contributionPageID variable that is already exists on the page. I know the query works, because if I substitute a number for the $contributionPageID I get a result. Any idea how I can pull the contributionPageID variable for use in this hook?