I'm having a strange problem using the CRM API thru PhP (i.e. not REST or AJAX). I'm trying to build a donations counter which tracks the total amount of contributions made under a specific contribution source. Everything works when I'm logged in. But when I'm not, I get a silent php error and my theme breaks. The only thing I can guess is that it might be related to user permissions. So I gave not logged in users the ability to Access CiviCRM and View Contributions. I can confirm this works using the dashboard. But I still cant get the API calls to work without breaking the site.
Things I have tried:
- Adding
'check_permissions' => false
to the call - Surrounding the calls in a try / catch block
- Switching user context in d7 to the root user and then back again.
Maybe it's not even a permissions problem after all..?
CiviCRM version is 4.7 with Drupal 7.