Answers.Body: <p>This diff is against 4.5.0  .  It doesn't display the custom field values on the PCP view page, but it adds the capability to create custom field groups on PCP entities, and save values on add/edit pages. </p>
  
  <pre><code>diff -r original/civicrm/CRM/Core/BAO/CustomGroup.php new/civicrm/CRM/Core/BAO/CustomGroup.php
  1102a1103,1104
  &gt;       case 'Pcp':
  &gt;         $tableName = 'civicrm_pcp';
  1168a1171
  &gt;       case 'Pcp':
  1521a1525
  &gt; 
  1698a1703,1704
  &gt;       case 'Pcp':
  &gt;         return 'civicrm_pcp';
  1721a1728
  &gt;   
  diff -r original/civicrm/CRM/Core/SelectValues.php new/civicrm/CRM/Core/SelectValues.php
  179a180
  &gt;       'Pcp' =&gt; ts('Personal Campaign Pages'),
  diff -r original/civicrm/CRM/Custom/Form/CustomData.php new/civicrm/CRM/Custom/Form/CustomData.php
  54c54
  &lt;   ) {
  ---
  &gt;   ) { 
  145c145
  &lt;     }
  ---
  &gt;     }   
  diff -r original/civicrm/CRM/PCP/BAO/PCP.php new/civicrm/CRM/PCP/BAO/PCP.php
  85c85,92
  &lt; 
  ---
  &gt;     //start custom field code addition
  &gt;     //store custom data
  &gt;     if (!empty($params['custom']) &amp;&amp;
  &gt;       is_array($params['custom'])
  &gt;     ) {
  &gt;       CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pcp', $dao-&gt;id);
  &gt;     }
  &gt;     //end custom field code addition
  diff -r original/civicrm/CRM/PCP/Form/Campaign.php new/civicrm/CRM/PCP/Form/Campaign.php
  63a64,87
  &gt;     
  &gt;     //start custom field code additions
  &gt;     //check for custom data type.
  &gt;     $this-&gt;_cdType = 'Pcp';
  &gt;     $this-&gt;assign('cdType', FALSE);
  &gt;     if ($this-&gt;_cdType) {
  &gt;       $this-&gt;assign('cdType', TRUE);
  &gt;       $this-&gt;set('type', 'Pcp');
  &gt;       $this-&gt;set('entityID', $this-&gt;_pageId);
  &gt;       $this-&gt;set('cgcount', 1);
  &gt;       CRM_Custom_Form_CustomData::preProcess($this);
  &gt;     }
  &gt;     //end custom field code additions
  &gt;     
  &gt;         // when custom data is included in form.
  &gt;     if (!empty($_POST['hidden_custom'])) {
  &gt;       $this-&gt;set('type', 'Pcp');
  &gt;       $this-&gt;set('entityID', $this-&gt;_pageId);
  &gt;       $this-&gt;set('cgcount', 1);
  &gt;       CRM_Custom_Form_CustomData::preProcess($this);
  &gt;       CRM_Custom_Form_CustomData::buildQuickForm($this);
  &gt;       CRM_Custom_Form_CustomData::setDefaultValues($this);
  &gt;     }
  &gt; 
  70c94,99
  &lt; 
  ---
  &gt;     //load only custom data defaults.
  &gt;     
  &gt;     if ($this-&gt;_cdType) {
  &gt;      $defaults = CRM_Custom_Form_CustomData::setDefaultValues($this);
  &gt;     }
  &gt;     
  93c122
  &lt; 
  ---
  &gt;  
  103a133,140
  &gt;     $this-&gt;assign('customDataType', 'Pcp');
  &gt;     $this-&gt;assign('entityID', $this-&gt;_pageId);
  &gt;    
  &gt;     if ($this-&gt;_cdType) {
  &gt;       CRM_Custom_Form_CustomData::buildQuickForm($this);
  &gt;     }
  &gt;     //lets assign custom data type and subtype.
  &gt;     
  229c266,274
  &lt; 
  ---
  &gt;     
  &gt;        //process custom data.
  &gt;     $customFields = CRM_Core_BAO_CustomField::getFields('Pcp', FALSE, FALSE);
  &gt;     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
  &gt;       $customFields,
  &gt;       $this-&gt;_pageId,
  &gt;       'Pcp'
  &gt;     );
  &gt;    
  232d276
  &lt; 
  Only in new/civicrm: groupcountsearch.txt
  diff -r original/civicrm/templates/CRM/PCP/Form/Campaign.tpl new/civicrm/templates/CRM/PCP/Form/Campaign.tpl
  97a98,120
  &gt; 
  &gt; {* load the custom data *}
  &gt; {if $cdType}
  &gt;     {include file="CRM/Custom/Form/CustomData.tpl"}
  &gt; {else}
  &gt; 
  &gt; {* include custom data js *}
  &gt; {include file="CRM/common/customData.tpl"}
  &gt; 
  &gt; {literal}
  &gt; &lt;script type="text/javascript"&gt;
  &gt;   CRM.$(function($) {
  &gt;     {/literal}{if $customDataSubType}
  &gt;       CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
  &gt;     {else}
  &gt;       CRM.buildCustomData( '{$customDataType}' );
  &gt;     {/if}
  &gt;     {literal}
  &gt;   });
  &gt; &lt;/script&gt;
  &gt; {/literal}
  &gt;   
  &gt; {/if} {* load custom data *} 
  99a123
  &gt; 
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T00:41:09.723Z
Answers.Text: This looks like a good start to a pull-request against the master branch for inclusion in the next version of CiviCRM.
Answers.UserDisplayName: Coleman
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T00:50:39.713Z
Answers.Text: I haven't learned to do that yet, that's why I posted it here, but I guess its high time I learned....got a decent but slightly rough PCP api to contribute too
Answers.UserDisplayName: jackrabbithanna
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T00:57:23.673Z
Answers.Text: views integration: Added two lines to this file: civicrm.views.inc, function civicrm_views_get_join_table(), around line 374
        case "Pcp":
           return 'civicrm_pcp';
Answers.UserDisplayName: jackrabbithanna
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T00:33:43.203Z
Answers.LastActivityDate: 2015-05-08T00:33:43.203Z
Answers.UserDisplayName: jackrabbithanna
Answers.Body: <p>Since you have a working patch for this feature, you can share your changes with the rest of the community by submitting a Pull-Request to CiviCRM:</p>
  
  <ol>
  <li>Use <a href="https://github.com/civicrm/civicrm-buildkit" rel="nofollow">buildkit</a> to create a local sandbox site for yourself, based on the master branch.</li>
  <li>Create a new branch</li>
  <li>Apply your patch</li>
  <li>Push the branch to your fork on github</li>
  <li>Click the "Compare &amp; Pull-Request" button on github.</li>
  </ol>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-05-08T01:08:50.383Z
Answers.LastActivityDate: 2015-05-08T01:08:50.383Z
Answers.UserDisplayName: Coleman
Body: <p>I bet that's a question that some people have asked before!</p>
  
  <p>The answer is you can't currently. </p>
  
  <p>But how would someone add this capability?</p>
  
Tags: <custom-fields><personal-campaign-pages>
Title: How do I add custom fields to Personal Campaign Pages
ThreadText: # How do I add custom fields to Personal Campaign Pages
  
  (Asked by: username_0 on 2015-05-08)
  
  I bet that's a question that some people have asked before!
  
  The answer is you can't currently.
  
  But how would someone add this capability?
  
  **Tags:** custom-fields, personal-campaign-pages
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2015-05-08. Score: 5
  
  This diff is against 4.5.0 . It doesn't display the custom field values on the PCP view page, but it adds the capability to create custom field groups on PCP entities, and save values on add/edit pages.
  
  ```
  diff -r original/civicrm/CRM/Core/BAO/CustomGroup.php new/civicrm/CRM/Core/BAO/CustomGroup.php
  1102a1103,1104
  >       case 'Pcp':
  >         $tableName = 'civicrm_pcp';
  1168a1171
  >       case 'Pcp':
  1521a1525
  > 
  1698a1703,1704
  >       case 'Pcp':
  >         return 'civicrm_pcp';
  1721a1728
  >   
  diff -r original/civicrm/CRM/Core/SelectValues.php new/civicrm/CRM/Core/SelectValues.php
  179a180
  >       'Pcp' => ts('Personal Campaign Pages'),
  diff -r original/civicrm/CRM/Custom/Form/CustomData.php new/civicrm/CRM/Custom/Form/CustomData.php
  54c54
  <   ) {
  ---
  >   ) { 
  145c145
  <     }
  ---
  >     }   
  diff -r original/civicrm/CRM/PCP/BAO/PCP.php new/civicrm/CRM/PCP/BAO/PCP.php
  85c85,92
  < 
  ---
  >     //start custom field code addition
  >     //store custom data
  >     if (!empty($params['custom']) &&
  >       is_array($params['custom'])
  >     ) {
  >       CRM_Core_BAO_CustomValueTable::store($params['custom'], 'civicrm_pcp', $dao->id);
  >     }
  >     //end custom field code addition
  diff -r original/civicrm/CRM/PCP/Form/Campaign.php new/civicrm/CRM/PCP/Form/Campaign.php
  63a64,87
  >     
  >     //start custom field code additions
  >     //check for custom data type.
  >     $this->_cdType = 'Pcp';
  >     $this->assign('cdType', FALSE);
  >     if ($this->_cdType) {
  >       $this->assign('cdType', TRUE);
  >       $this->set('type', 'Pcp');
  >       $this->set('entityID', $this->_pageId);
  >       $this->set('cgcount', 1);
  >       CRM_Custom_Form_CustomData::preProcess($this);
  >     }
  >     //end custom field code additions
  >     
  >         // when custom data is included in form.
  >     if (!empty($_POST['hidden_custom'])) {
  >       $this->set('type', 'Pcp');
  >       $this->set('entityID', $this->_pageId);
  >       $this->set('cgcount', 1);
  >       CRM_Custom_Form_CustomData::preProcess($this);
  >       CRM_Custom_Form_CustomData::buildQuickForm($this);
  >       CRM_Custom_Form_CustomData::setDefaultValues($this);
  >     }
  > 
  70c94,99
  < 
  ---
  >     //load only custom data defaults.
  >     
  >     if ($this->_cdType) {
  >      $defaults = CRM_Custom_Form_CustomData::setDefaultValues($this);
  >     }
  >     
  93c122
  < 
  ---
  >  
  103a133,140
  >     $this->assign('customDataType', 'Pcp');
  >     $this->assign('entityID', $this->_pageId);
  >    
  >     if ($this->_cdType) {
  >       CRM_Custom_Form_CustomData::buildQuickForm($this);
  >     }
  >     //lets assign custom data type and subtype.
  >     
  229c266,274
  < 
  ---
  >     
  >        //process custom data.
  >     $customFields = CRM_Core_BAO_CustomField::getFields('Pcp', FALSE, FALSE);
  >     $params['custom'] = CRM_Core_BAO_CustomField::postProcess($params,
  >       $customFields,
  >       $this->_pageId,
  >       'Pcp'
  >     );
  >    
  232d276
  < 
  Only in new/civicrm: groupcountsearch.txt
  diff -r original/civicrm/templates/CRM/PCP/Form/Campaign.tpl new/civicrm/templates/CRM/PCP/Form/Campaign.tpl
  97a98,120
  > 
  > {* load the custom data *}
  > {if $cdType}
  >     {include file="CRM/Custom/Form/CustomData.tpl"}
  > {else}
  > 
  > {* include custom data js *}
  > {include file="CRM/common/customData.tpl"}
  > 
  > {literal}
  > <script type="text/javascript">
  >   CRM.$(function($) {
  >     {/literal}{if $customDataSubType}
  >       CRM.buildCustomData( '{$customDataType}', {$customDataSubType} );
  >     {else}
  >       CRM.buildCustomData( '{$customDataType}' );
  >     {/if}
  >     {literal}
  >   });
  > </script>
  > {/literal}
  >   
  > {/if} {* load custom data *} 
  99a123
  > 
  
  ```
  
  > **Comments:**
  > **username_1**: This looks like a good start to a pull-request against the master branch for inclusion in the next version of CiviCRM.  
  > **username_0**: I haven't learned to do that yet, that's why I posted it here, but I guess its high time I learned....got a decent but slightly rough PCP api to contribute too  
  > **username_0**: views integration: Added two lines to this file: civicrm.views.inc, function civicrm_views_get_join_table(), around line 374       case "Pcp":          return 'civicrm_pcp';  
  
  ---
  
  ### Answer by username_1 on 2015-05-08. Score: 0
  
  Since you have a working patch for this feature, you can share your changes with the rest of the community by submitting a Pull-Request to CiviCRM:
  
  1. Use [buildkit](https://github.com/civicrm/civicrm-buildkit) to create a local sandbox site for yourself, based on the master branch.
  2. Create a new branch
  3. Apply your patch
  4. Push the branch to your fork on github
  5. Click the "Compare & Pull-Request" button on github.
  
  
  ---
  
  