Answers.Body: <p>Interesting. Thank you for the leads. I went through them all and they were all set to defaults. What ended up fixing my issue was assigning the user role permission: </p>
  
  <pre><code>CiviEvent: access CiviEvent
  Create events, view all events, and view participant records (for visible contacts)
  </code></pre>
  
  <p>In the view in question I was using a PHP field to list all active events, then find all the "parent of" relationships for the currently signed-in user, pulling up their participations, then outputting a list of all the children registered for active events. </p>
  
  <p>I see now that the code runs are the current user. Given that I do not actually want to allow said permissions to that user role, is there any way to have that field "run-as" some other role, rather than provide inordinate power to the user?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-22T00:21:35.463Z
Answers.LastActivityDate: 2017-11-22T00:21:35.463Z
Answers.UserDisplayName: Derek
Answers.Body: <p>This is likely due to trying to pull a view to a user that isn't allowed to see it. Can you restrict access to those views to only the user and admin user so that other users can't see the views?</p>
  
  <p>If that isn't the intensional effect, check the following permissions:</p>
  
  <ul>
  <li><p>views permission (in the views settings)</p></li>
  <li><p>CiviCRM permissions (in People > Permissions on the Drupal side)</p></li>
  <li><p>block permissions (in the block settings)</p></li>
  <li>permissions on any custom fields that the view uses (in Drupal or in CiviCRM profiles)</li>
  </ul>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-11-21T01:20:47.853Z
Answers.LastActivityDate: 2017-11-21T01:20:47.853Z
Answers.UserDisplayName: Christia
Body: <p>Running into a crazy error that came to me out of the blue. I have a simple page with a few views showing CiviCRM entities. </p>
  
  <p>When I view this page as an administrator, or as the user showing the warning, everything looks and works just fine. </p>
  
  <p>The issue is that the non-administrative users get this blaring error and I can't seem to figure out why...</p>
  
  <p>Any ideas as to what permissions issue this might be? </p>
  
  <p>Cheers!</p>
  
  <pre><code>Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  </code></pre>
  
Tags: <civievent><drupal><permissions>
Title: Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of BAO/Event.php)
ThreadText: # Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of BAO/Event.php)
  
  (Asked by: username_0 on 2017-11-21)
  
  Running into a crazy error that came to me out of the blue. I have a simple page with a few views showing CiviCRM entities.
  
  When I view this page as an administrator, or as the user showing the warning, everything looks and works just fine.
  
  The issue is that the non-administrative users get this blaring error and I can't seem to figure out why...
  
  Any ideas as to what permissions issue this might be?
  
  Cheers!
  
  ```
  Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  Warning: in_array() expects parameter 2 to be array, null given in CRM_Event_BAO_Event::checkPermission() (line 2053 of /public_html/sites/all/modules/contrib/civicrm/CRM/Event/BAO/Event.php).
  
  ```
  
  **Tags:** civievent, drupal, permissions
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2017-11-22. Score: 0 | Accepted answer
  
  Interesting. Thank you for the leads. I went through them all and they were all set to defaults. What ended up fixing my issue was assigning the user role permission:
  
  ```
  CiviEvent: access CiviEvent
  Create events, view all events, and view participant records (for visible contacts)
  
  ```
  
  In the view in question I was using a PHP field to list all active events, then find all the "parent of" relationships for the currently signed-in user, pulling up their participations, then outputting a list of all the children registered for active events.
  
  I see now that the code runs are the current user. Given that I do not actually want to allow said permissions to that user role, is there any way to have that field "run-as" some other role, rather than provide inordinate power to the user?
  
  
  ---
  
  ### Answer by username_1 on 2017-11-21. Score: 1
  
  This is likely due to trying to pull a view to a user that isn't allowed to see it. Can you restrict access to those views to only the user and admin user so that other users can't see the views?
  
  If that isn't the intensional effect, check the following permissions:
  
  * views permission (in the views settings)
  * CiviCRM permissions (in People > Permissions on the Drupal side)
  * block permissions (in the block settings)
  * permissions on any custom fields that the view uses (in Drupal or in CiviCRM profiles)
  
  
  ---
  
  