Answers.Body: <p><a href="https://lab.civicrm.org/dev/core/-/issues/4006#register-pane" rel="nofollow noreferrer">This fix</a> on GitLab solves the problem for this specific file. I found other places that this is happening and I will need to work on those on their own.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-04-22T22:14:04.510Z
Answers.LastActivityDate: 2023-04-22T22:14:04.510Z
Answers.UserDisplayName: Drupal Learner
Body: <p>When I try to add an offline contribution the soft credits portion of the screen shows a PHP Warning rather than the fields for the soft credit. <a href="https://i.sstatic.net/iW9PZ.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iW9PZ.png" alt="soft credits forms section only shows PHP warning" /></a></p>
  <p>The warning is</p>
  <blockquote>
  <p>Warning: Undefined array key &quot;siteHasPCPs&quot; in
  /var/www/private_fs/civicrm/templates_c/en_US/%%6F/6F7/6F7BB438%%Contribution.tpl.php
  on line 378</p>
  </blockquote>
  <p>The only solution I have found is changing line 378.</p>
  <p>The line I have is  <code>&lt;?php if ($this-&gt;_tpl_vars['siteHasPCPs']  &amp;&amp; ! $this-&gt;_tpl_vars['payNow']): ?&gt;</code></p>
  <p>If I add <code>?? NULL</code> after <code>$this-&gt;_tpl_vars['siteHasPCPs']</code> the line becomes <code> &lt;?php if ($this-&gt;_tpl_vars['siteHasPCPs'] ?? NULL  &amp;&amp; ! $this-&gt;_tpl_vars['payNow']): ?&gt;</code></p>
  <p>This change makes the form load as expected.  <a href="https://i.sstatic.net/VcOBx.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/VcOBx.png" alt="CiviCRM Soft Credit section loading as expected" /></a></p>
  <p>Before making changes to the code I tried flushing the caches and deletting the templates so that CiviCRM can regenerate them. For each of these attempts I get no change to the issue.</p>
  <p>I am running CiviCRM 5.59.3 with Drupal 9.5.5.</p>
  <p>I think this was happening before the upgrade but I cannot be positive.  I Googled with some different terms this morning and found an issue related to this on the CiviCRM GitLab instance.  <a href="https://lab.civicrm.org/dev/core/-/issues/4006#register-pane" rel="nofollow noreferrer">https://lab.civicrm.org/dev/core/-/issues/4006#register-pane</a></p>
  <p>If I get an answer there I will update this question.</p>
  <p>Thanks!!</p>
  
Tags: <forms><soft-credit>
Title: Soft Credits Section Does Not Load
ThreadText: # Soft Credits Section Does Not Load
  
  (Asked by: username_0 on 2023-03-24)
  
  When I try to add an offline contribution the soft credits portion of the screen shows a PHP Warning rather than the fields for the soft credit. [![soft credits forms section only shows PHP warning](https://i.sstatic.net/iW9PZ.png)](https://i.sstatic.net/iW9PZ.png)
  
  The warning is
  
  > Warning: Undefined array key "siteHasPCPs" in
  > /var/www/private\_fs/civicrm/templates\_c/en\_US/%%6F/6F7/6F7BB438%%Contribution.tpl.php
  > on line 378
  
  The only solution I have found is changing line 378.
  
  The line I have is `<?php if ($this->_tpl_vars['siteHasPCPs'] && ! $this->_tpl_vars['payNow']): ?>`
  
  If I add `?? NULL` after `$this->_tpl_vars['siteHasPCPs']` the line becomes  `<?php if ($this->_tpl_vars['siteHasPCPs'] ?? NULL && ! $this->_tpl_vars['payNow']): ?>`
  
  This change makes the form load as expected. [![CiviCRM Soft Credit section loading as expected](https://i.sstatic.net/VcOBx.png)](https://i.sstatic.net/VcOBx.png)
  
  Before making changes to the code I tried flushing the caches and deletting the templates so that CiviCRM can regenerate them. For each of these attempts I get no change to the issue.
  
  I am running CiviCRM 5.59.3 with username_0 9.5.5.
  
  I think this was happening before the upgrade but I cannot be positive. I Googled with some different terms this morning and found an issue related to this on the CiviCRM GitLab instance. <https://lab.civicrm.org/dev/core/-/issues/4006#register-pane>
  
  If I get an answer there I will update this question.
  
  Thanks!!
  
  **Tags:** forms, soft-credit
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2023-04-22. Score: 0
  
  [This fix](https://lab.civicrm.org/dev/core/-/issues/4006#register-pane) on GitLab solves the problem for this specific file. I found other places that this is happening and I will need to work on those on their own.
  
  
  ---
  
  