• Resolved radz123

    (@radz123)


    Hi Pods Team and or Pods Community Experts,

    I’d like to request your assistance regarding Pods.

    Here’s what I did thus far. I created a custom post type named “emr” or basically an Electronic Medical Record containing a users diagnosis, prescription etc. I also added a field in relating to ‘User’ (Name and ID) and Bi-Directional to an ‘My EMR’ custom User field.

    So when I submitted a post and added the name of the user it then gets associated to the user.

    However, here’s my problem. I want to display the list of associated EMR’s for the user in a separate tab in their WordPress My Account section. I tried using the pods shortcodes but it just showed a form format not the list itself.

    How do you think I can achieve this? Can I do this with shortcode combinations?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jory Hogeveen

    (@keraweb)

    Hello @radz123

    I want to display the list of associated EMR’s for the user in a separate tab in their WordPress My Account section.

    WordPress doesn’t have a My Account section on the front end. What plugin are you using for this?

    If you want to use a shortcode you should be able to use the following for example:
    [pods use_current="1" template="Your EMR list template"]

    Cheers, Jory

    Thread Starter radz123

    (@radz123)

    Hi Jory,

    Thank you so much for your quick response and assistance. I tried what you suggested but it only gave me a ‘Pod not found’ message on the page.

    I also tried [pods name=”user” template=”Template”] which worked but it showed all the ‘EMR’ custom posts types from all users. I just want it to only show the list of ‘EMR’ post type associated with the current logged-in user.

    It looks like I can see this in my WordPress Edit Profile section
    https://prnt.sc/v5qwag

    I just want to replicate the same in the frontend.

    I’m using WooCommerce I think the My Account Page may have been a WooCommerce endpoint.

    Let me know your thoughts

    Thread Starter radz123

    (@radz123)

    Basically, to explain what I’m trying to achieve here is to allow Doctors to fill in a Pods Form and simply add associate a custom post type ‘EMR” to a user via Bi-directional relationship. I was able to do this but I also want the user to see his/her associated EMR post types in a page.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @radz123

    Ah right, a WooCommerce account page isn’t a user profile in terms of page context.
    In that case you’ll have to fetch the current user ID and add it to the id param like so:

    [pods name="user" id="{@user.ID}" template="Template"]

    Keep in mind that this shortcode will always refer to the current logged in user!

    Cheers, Jory

    Thread Starter radz123

    (@radz123)

    Hi Jory,

    I really appreciate the support so far. And I’m really eager to get this sorted. Unfortunately, the shortcode doesn’t show anything and it appeared blank. I’ve tried changing the combinations of the pods fields and it didn’t work.

    I also tried using this shortcode as indicated in the documentation.

    [pods name=”user” where=”id = {@user.id}”]{@my_emr.patient.my_emr}[/pods]

    Also, didn’t work. Here’s my User (extended) pods fields are currently set up
    https://prnt.sc/v7nkfg

    Then here’s the ’emr’ custom post type which will be associated a user using the ‘patient’ field bi-directional to the ‘my_emr’ in the User pod.

    https://prnt.sc/v7nltl

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @radz123

    See this page: https://docs.pods.io/displaying-pods/magic-tags/special-magic-tags/

    Important: In many cases, such as inside a shortcode, or in the Pods widget settings, you must add the following define(‘PODS_SHORTCODE_ALLOW_EVALUATE_TAGS’,true); to your wp_config.php for these tags to be used.

    Did you add this constant?

    Cheers, Jory

    Thread Starter radz123

    (@radz123)

    Hi Jory,

    Thank you for your response.

    Yes, I added this now, but still don’t show any data.

    See – https://prnt.sc/v7vwv3

    Here’s my ‘Template’ using pod-reference to ‘User’

    https://prnt.sc/v7vvwe

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Associate Custom Post Types and Display in Profile’ is closed to new replies.