Portal (self-registration)

On revisiting the Portal after a couple of years - on version5.0.2(5), I figured I’d see what has changed. I tried to self-register a patient but it failed.

DataAdapter (default) Error Selecting SQL: Unknown column 'patient_data.county' in 'field list' (retry attempts: 0)

Can anyone tell me when/where “county” is added to patient_data table? It doesn’t appear in the sql files and it is required to get the self registration aspect of the portal to work. Maybe it is not needed for other parts of the portal to work? Seems like it is needed…

I added it via phpmyadmin with:

ALTER TABLE patient_data ADD county VARCHAR(255) NULL AFTER country_code;

Retry and I progress but receive another error:

DataAdapter (default) Error Selecting SQL: Unknown column 'users.portal_user' in 'field list' (retry attempts: 0)

I found the patch.sql which adds this field, but I receive the error:

Field 'subtype' doesn't have a default value

which refers to line 52, causing the rest of the patch to fail.

Next I issued the sql command:

ALTER TABLE list_options CHANGE subtype subtype VARCHAR(31) CHARACTER SET utf8 COLLATE utf8_general_ci NULL;

Had to rerun the patch.sql line by line in phpmyadmin after that.

Finally registration proceeded and final pop-up:

Unable to either create credentials or send email.

Here is what we do know.:

Query Error

ERROR: query failed: INSERT INTO patient_access_onsite SET portal_username=?,portal_onetime=?,portal_pwd=?,portal_pwd_status=0,portal_salt=? ,pid=?

Error: Unknown column ‘portal_salt’ in ‘field list’

/var/www/openemr/portal/account/account.lib.php at 201:sqlStatementNoLog
/var/www/openemr/portal/account/account.php at 81:doCredentials(4464)

Appears sql_upgrade 5.0.2 is not for 5.0.2(5) since it drops this field…
Readded it via:
ALTER TABLE patient_access_onsite ADD COLUMN portal_salt VARCHAR(100) NULL;

and it worked!

Hopefully this helps others who may have similar issues.

weird. @ophthal,
also note OpenEMR 5.0.2 Patch.
it has the allow use of LBF in portal patient documents.
Also for portal profile if missing any default DEM LBF rows, then may error. I’m working on a patch to avoid those in the CRUD.
You can Exclude in Portal via row option in layout editor.

I do not understand what you are saying here so I decided to start over with the demo


I assume this is current release code. With self-registration enabled in globals I cannot self-register there either. Looking at the browser console log, there are js errors and finally at the last step it does not send the email. Perhaps the js errors don’t stop registration and maybe the “email credentials” part of the demo is not enabled?

yep, v6.0 had a bug I just fixed with register.

You have to setup email in notifications for that to work.
more here: Onsite Patient Portal self- registration broken in 6.0?

Hi Folks-
Here’s how Ken got gmail SMTP to work with OpenEMR’s Notifications and the Patient Portal self registration function.
NOTE: as I recall, gmail only allows a very low volume of outgoing traffic for their personal email accounts so this is only good for testing, not to use in production for a clinic’s patient notifications.

  1. If needed, find your gmail account’s SMTP settings at:

According to that page, this account’s were:
Outgoing Mail (SMTP) Server: smtp.gmail.com
Requires SSL: Yes
Requires TLS: Yes (if available)
Requires Authentication: Yes
Port for SSL: 465
Port for TLS/STARTTLS: 587

Full Name or Display Name: Your name
Account Name, User name, or Email address: Your full email address
Password: Your Gmail password

ALSO- enable “less secure apps” on the gmail account.
Look in in the dropdown, ‘If “Less secure app access” is off for your account’.
Click the link, ‘turn it back on’ for instructions.

  1. In your OpenEMR go to:
    (from main menu:) Administration -> Globals -> Notifications tab

  2. Set the following items:
    Patient Reminder Sender Name: [perhaps use your OpenEMR’s facility name?]
    Patient Reminder Sender Email: [your gmail address]
    Notification Email Address: [your gmail address]
    Email Transport Method: select from dropdown, SMTP
    SMTP Server Hostname: smtp.gmail.com
    SMTP Server Port Number: 465
    SMTP User for Authentication: [your gmail address]
    SMTP Password for Authentication: [your gmail password]
    SMTP Security Protocol: SSL

  3. Click ‘Save’

  4. Log out of the OpenEMR then back in.

I went about attempting to setup the gmail account option described here but Google is now removing the ‘less secure apps’ option in May 2022. So people should avoid the GMAIL smtp option. I’ve gone ahead and updated the email sending option in the wiki and included an example for Mailgun (which is what I use for my own business) in case people want to use that.


I don’t know if that clickatell and sms stuff is even used anymore on that wiki page but I left it in there just in case.