CMS Portal update and Frontend PM to replace cartpauj-pm

I am now trying to model the upload on what was done for Ninja Forms. This is what I have tried:

function action_getmsgup($uploadid) {
  global $wpdb, $out;
  $query = $wpdb->prepare("SELECT ID, post_mime_type, guid FROM {$wpdb->prefix}posts WHERE ID = %d", array($uploadid));
  $rows = $wpdb->get_results($query, ARRAY_A);

  foreach ($rows as $row) {
	$url = $row['guid'];
    $filename = basename($url);
	$path  = parse_url($url, PHP_URL_PATH); // just the path part of the URL
    $parts = explode('/', $path);           // all the components
	$parts = array_slice($parts, -6);       // the last six
	$path  = implode('/', $parts);  
    $filepath = ABSPATH . $path;
    $contents = file_get_contents($filepath);
    if ($contents === false) {
      $out['errmsg'] = "Unable to read \"$filepath\"";
      return;
    }
	$out['filename'] = $filename;
	$out['mimetype'] = $row['mimetype'];
    $out['datetime'] = $row['post_date'];
    $out['contents'] = base64_encode($contents);
  }
}

Still I am just getting the upload of the file and it will not show up in the object viewer. I have also tried it without the base64_encode and still no object viewer is responding. The good news is the upload works with file_get_contents() now.

Are you windows? Check properties on uploaded file and see if it is blocked and for now you don’t need base64 for Document viewer however I’m going to patch the viewer for an object instead of iframe for display. What version OpenEMR are you working with?

Version Number: v5.0.0 (3)

I have compared two uploads of the same file: one from cartpauj-pm and the other from Frontend PM. Looking at the results in \openemr\sites\default\documents\922 – With the exception of their names, both are identical when compared in Notepad ++. Checking properties does not show any blocks. The file uploaded from cartpauj-pm – file1.pdf shows up in the viewer the file from Frontend PM does not. Then, I reversed their names. Regardless, file1.pdf shows up in the viewer. So, I do not think the problem is on OpenEMR’s side but on mine. I must be missing something in the upload.

You might try escaping the uri and file name. Maybe cartpauj-pm is escaping and Frontend PM doesn’t.

I found the issue, I looked at the documents table and found that the mime type is not importing. That should be easy to fix. Thanks for bearing with me.

Didn’t do much but glad you are on your way.

My working modifications are now posted at:

My only concern now is the complexity of my queries. They work. But I probably did not write the most graceful solution. I did not post these to a full webserve.php file because they can be pasted into the standard one that is built for Ninja forms. The build I am using I designed to work with DFCB instead. CFDB was great because it worked with multiple forms application but the developer has stopped developing for it and so it is not keeping up with Wordpress changes. My next project is to write queries for the webserve.php that will work with Gravity Forms. When I am done with that I will post a full webserve.php for Frontend PM and Gravity Forms.

I found one more issue. Cartpauj-PM only allows one administrator. Frontend PM allows multiple administrators. This is better for multiple clinicians. So, I have replaced these two variables:

 $adminOps = get_option('cartpaujPM_options');
 $admin_user_login = $adminOps['admin_user_login'];

With this:

$adminOps = fep_get_option('oa_admins', array());
$wpuser = get_user_by( 'email', $_REQUEST['login'] );
$userlogin = $wpuser->user_login;
$count = count($adminOps)-1;

$i = 0;
$admins = array();
while($i <= $count) {
	$admins[] = $adminOps['oa_' . $i ]['username'];
	$i++;
}

if (in_array($userlogin, $admins)){
	$admin_user_login = $userlogin;
} else {
	  $out['errmsg'] = $userlogin ." is not an authorized administrator in Frontend PM Pro. Please go to Frontend PM Pro > Settings > Recipiant and add the user name to the Admins field.";
}

I think this does it all. I have updated my snippets file on github to reflect this.

A full explanation of how to integrate Front End PM Pro is now posted here:

How to Integrate Front End PM Pro with OpenEMR

Hi all,
Regarding this thread, I am currently setting up a new private practice and will be using openemr with the WP patient portal. I am using this

https://www.open-emr.org/wiki/index.php/Patient_Portal#Configuring_WordPress

for the tutorial. But I notice there is no:

Cartpauj PM (1.0.11 or greater)
Ninja Forms File Uploads (optional, non-free)
Ninja Forms Conditionals (optional, non-free)

Should I update the wiki?
I can also add this link:

GitHub - CraigT543/Sunset-Patient-Portal-with-FrontendPM: Modifications of the Sunset-Patient-Portal to work with the Frontend PM messaging system

Sandra

hi @gutiersa, did you check out the Onsite Patient Portal ? There’s been a lot of recent work on it.

No I have not, but I will then. thanks.

Do you mean the native patient portal?

yes, @sjpadgett has done a lot of work and @tywrenn as well, will serve us well in 5.0.2 and even more so when 5.0.3 comes out

Are these instructions accurate?

https://www.open-emr.org/wiki/index.php/Patient_Portal

Also, I have a multi-site install, what should be my portal address then?, and isn’t risky to give patients access to my openemr installation?
Regarding the portal site address, does this look correct:

https://mydomain.com/openemr/patients/index.php?site=mysite

My Frontend PM modifications no longer work. I have not had the time to update it. I am still using Frontend PM for private messaging but it does not import into OpenEMR. But the Cartpauj-PM integration was not really that helpful. It only let you know the message existed and you had to copy physically the message from the dashboard into your patients file. So that was easy enough for me to do if I have the wordpress site open in another window. Frontend PM works similar to Cartpauj-PM in that when both people have deleted the message the message disappears from the database. However, if a client never deletes the message it just stays there. In Frontend PM you can delete messages that are onlder than x months etc. So I let patients know that messages older than 6 months will be deleted.

1 Like

it’s Version 2 in those outdated instructions

it’s only for the patient and has been secured even more so by patch 2
here’s a helpful post

https://mydomain.com/portal/index.php?site=mysite
1 Like

I can’t get into the portal!

hi @gutiersa, how so?

Well I am not able to find the dashboard
I also don’t know how to send the patients a link or how to set up documents.