Answers.Body: <p>See <a href="https://civicrm.org/advisory/civi-sa-2024-03-smarty-security-policy" rel="nofollow noreferrer">https://civicrm.org/advisory/civi-sa-2024-03-smarty-security-policy</a></p>
  <p>You can either use the mentioned hook or you might be able to replace the crmapi call with a token, since there are more tokens nowadays.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-04T17:56:56.897Z
Answers.Text: Intersesting behavior... When I first added the hook/function and tried again, it succesfully generated the PDF except the PDF was completely blank. Then when I try do it again (making sure the hook/function is still active), I start getting the same error about crmAPI being disabled by security settings.
Answers.UserDisplayName: jsherk
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2024-08-04T12:40:06.357Z
Answers.LastActivityDate: 2024-08-04T12:40:06.357Z
Answers.UserDisplayName: Demerit
Body: <p>I am using CiviCRM v5.75.0 on WordPress v6.6.1</p>
  <p>When I go to generate a PDF Thank You letter using a saved smarty template that used to work, I get the following error message:</p>
  <pre><code>Message was not parsed due to invalid smarty syntax : Tag 'crmAPI' is not allowed in secure mode.
  </code></pre>
  <p>Going to system status, I see a message about Smarty Update that tells me to put the following into <code>civicrm.settings.php</code> :
  <code>define('CIVICRM_SMARTY_AUTOLOAD_PATH', '/path/to/civi/wp-content/plugins/civicrm/civicrm/packages/smarty4/vendor/autoload.php');</code></p>
  <p>When I try to generate the PDF again, I get similar but different error message:</p>
  <pre><code>Message was not parsed due to invalid smarty syntax : Syntax error in template &quot;eval:{crmScope extensionKey=&quot;&quot;}&lt;!-- ** TEMPLA...&quot; on line 55 &quot;{crmAPI var='resultFinancialType' entity='FinancialType' action='get' id=$financial_type_id}&quot; tag 'crmAPI' disabled by security setting
  </code></pre>
  <p>So I am not sure what I need to do to fix this.
  Thanks</p>
  
Tags: <wordpress><smarty><smarty3>
Title: CiviCRM on WordPress SMARTY issue Tag 'crmAPI' disabled by security setting
ThreadText: # CiviCRM on WordPress SMARTY issue Tag 'crmAPI' disabled by security setting
  
  (Asked by: username_0 on 2024-08-04)
  
  I am using CiviCRM v5.75.0 on WordPress v6.6.1
  
  When I go to generate a PDF Thank You letter using a saved smarty template that used to work, I get the following error message:
  
  ```
  Message was not parsed due to invalid smarty syntax : Tag 'crmAPI' is not allowed in secure mode.
  
  ```
  
  Going to system status, I see a message about Smarty Update that tells me to put the following into `civicrm.settings.php` :
  `define('CIVICRM_SMARTY_AUTOLOAD_PATH', '/path/to/civi/wp-content/plugins/civicrm/civicrm/packages/smarty4/vendor/autoload.php');`
  
  When I try to generate the PDF again, I get similar but different error message:
  
  ```
  Message was not parsed due to invalid smarty syntax : Syntax error in template "eval:{crmScope extensionKey=""}<!-- ** TEMPLA..." on line 55 "{crmAPI var='resultFinancialType' entity='FinancialType' action='get' id=$financial_type_id}" tag 'crmAPI' disabled by security setting
  
  ```
  
  So I am not sure what I need to do to fix this.
  Thanks
  
  **Tags:** wordpress, smarty, smarty3
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-08-04. Score: 0
  
  See <https://civicrm.org/advisory/civi-sa-2024-03-smarty-security-policy>
  
  You can either use the mentioned hook or you might be able to replace the crmapi call with a token, since there are more tokens nowadays.
  
  > **Comments:**
  > **username_0**: Intersesting behavior... When I first added the hook/function and tried again, it succesfully generated the PDF except the PDF was completely blank. Then when I try do it again (making sure the hook/function is still active), I start getting the same error about crmAPI being disabled by security settings.  
  
  ---
  
  