# Encounter Provider defaulting issue when creating new encounter

**URL:** <https://community.open-emr.org/t/encounter-provider-defaulting-issue-when-creating-new-encounter/26808>\
**Category:** Support\
**Created:** [May 29, 2026, 1:01am UTC](https://community.open-emr.org/t/encounter-provider-defaulting-issue-when-creating-new-encounter/26808 "2026-05-29T01:01:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ninjatx](https://community.open-emr.org/letter_avatar_proxy/v4/letter/n/898d66/32.png) [@ninjatx](https://community.open-emr.org/u/ninjatx)\
**Post date:** [May 29, 2026, 1:01am UTC](https://community.open-emr.org/t/encounter-provider-defaulting-issue-when-creating-new-encounter/26808/1 "2026-05-29T01:01:43Z")

</div>

**Situation**  
I found what appears to be an order-dependent Encounter Provider defaulting issue in OpenEMR 8.0.0 patch 3, and I was able to reproduce the same behavior in the online demo.

Scenario:

- Create/log in as a non-provider staff user.
- Provider checkbox is unchecked.
- See Authorizations is set to None.
- NPI/taxonomy are blank.
- Create a new encounter directly, with no appointment provider involved.

Observed behavior:  
If the non-provider staff user’s last name sorts after at least one active provider, the Encounter Provider field defaults to the logged-in staff user and displays them as “Name (Non-Provider).”

If the non-provider staff user’s last name sorts before the providers, the issue may not appear.

Root cause appears to be in:  
interface/forms/newpatient/C\_EncounterVisitForm.class.php

Inside getProvidersForTemplate(), when provider\_id is empty, the code falls back to $\_SESSION[‘authUserID’] without first confirming that the logged-in user is actually a provider. Because the active users are processed in name order, this can cause a non-provider staff user to become selected as Encounter Provider depending on where they fall in the sorted user list.

Expected behavior:  
The logged-in user should only be used as the default Encounter Provider if users.authorized = 1 / Provider is checked. Non-provider staff should not be auto-selected as the encounter provider.

Proposed fix:  
Gate the fallback to $\_SESSION[‘authUserID’] so it only happens when the logged-in user is an actual provider. Appointment provider defaults and historical encounters with a saved non-provider provider\_id should still be preserved.

 ![OpenEMR Encounter Bugs](https://discourse-uploads-openemr.s3.dualstack.us-east-1.amazonaws.com/original/3X/f/c/fc5b727686edeb083794d1a64703767efaa5f172.jpeg)

**OpenEMR Version**  
I’m using OpenEMR version 8.0.0 patch 3

**Browser** :  
I’m using: Chrome

**Operating System**  
I’m using: Debian

**Search**  
Did you search the forum for similar questions?

**Logs**  
Did you check the logs?  
Was there anything pertinent in them?  
Please paste them here (surround with three backticks (```) for readability.  
You can also turn on User Debugging under Administration-\>Globals-\>Logging User Debugging Options=\>All
