0

All

In my application, I am really confused that how to set the project flow in wordpress.

There are 3 Users. 1. Admin : High level mgmt 2. Doctors : Add patients reports 3. Patients : Can see reports added by doctors.

I am considering post as a reports.

Prob 1: How to assign specif (user)doctor to patient(user)? While patient(user) fill the registration form.

Prob 2: After patient select doctor while filling the form, now doctor can generate reports to specific users(patients).

Prob 3: How display specific category post(Patients Reports) to specific users(Patients)?

I Know there is no ready made plugin for it, i just want to know that how to set this flow in wordpress and which plugins can help me. What should i need to customize ?

Thanks In advance !

1 Answer 1

1

I'll take a stab. I won't include any code examples, just the path I would take.

Users

I image when you say "users" you mean different roles for users. "doctor user" is just a user with the role of "doctor" (see here: http://codex.wordpress.org/Roles_and_Capabilities).

So, I would start by creating 2 new roles: "doctor" and "patient".

Problem 1

The simplest way to create a relation between 2 users (a doctor and a patient) would be to use usermeta. I would store the patient's doctor user_id in the patient's usermeta. You will have to do some custom registration form to show a list of doctors (get_users( 'role=doctor' )) then save the usermeta for the new user on wp_insert_user.

Problem 2

I don't know what your reports are, but if a doctor just needs to be able to get a list of their patients, you would need to do a $wpdb->get_col() on the usermeta table (as you stored it in the patient's usermeta, you can't use the get_usermeta API.

Problem 3

Presumable you will use a custom post type for reports, and you want the patient to only be able to see their own report. To do this I would probably save some postmeta on the patient report of _patient_user_id. Then when you want to show the reports for a user you can do something like

new WP_Query( 'post_type=report&meta_key=_patient_user_id&meta_value=' . get_current_user_id() ) 

(or something similar).

Personally, I probably wouldn't use any plugins here - you could use a role manager plugin for the roles, but creating them programmatically is pretty quick. Again, you can get plugins to create your custom post types - IMO it's a lot easy and better to do it all with code.

1
  • You know bro,i got the perfect as i want . Thanks :)
    – Ajay Patel
    Jan 26, 2012 at 12:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.