• Resolved clancel

    (@clancel)


    Hi. I have a added extended fields in the User pod. I have also created a User Template with User pod as a reference. What I wish to do is to embed the User Template that I created in a new tab in Woocommerce My Account Page. My aim is to display user meta to logged in users. The shortcode (see below) that I used brings up user meta of all users instead of a logged in user.

    [pods name=”user” template=”User Template”]

    I have also tried the following with Special Magic Tags,

    [pods name=”user” where=”id = {@user.id}”]Hello! {@display_name}[/pods]

    This short does display the logged in user meat but then the User Template is completely unnecessary. Is there a way for me to use the User Template with special magic tags in a shortcode?

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

    (@keraweb)

    Hi @clancel

    Since you want to show information about that user’s profile I think the use_current parameter would work:
    [pods use_current=1 template="User Template"]

    Cheers, Jory

    Thread Starter clancel

    (@clancel)

    Thank you for your reply. Would you mind explaining what “1” is? I tried this shortcode you gave me but I’m getting a “Pod not found” message. I wish to show the user meta fields of a logged in user through template on a Woocommerce My Account Menu. At the moment, I can’t seem to find out how to get the template to work with a code snippet. So I’m typing out the content that I used in the User Template to show the special magic tags. I wish to use the User Template instead of typing out the text. The woocommerce code snippet is as follows,

    // ——————
    // 4. Add content to the new endpoint

    function bbloomer_lesson_record_content() {
    echo do_shortcode( ‘[pods name=”user” where=”ID = {@user.ID}”]Welcome back {@display_name}! You have {@remaining_lessons} remaining in your lesson card. <br /> You last lesson was on {@last_lesson}. Your card will expire on {@card_expiration_date}.[/pods]’);
    echo “<u><h4>Lesson Dates</h4></u>”;
    }

    add_action( ‘woocommerce_account_lesson-record_endpoint’, ‘bbloomer_lesson_record_content’ );
    // Note: add_action must follow ‘woocommerce_account_{your-endpoint-slug}_endpoint’ format

    Plugin Author Jory Hogeveen

    (@keraweb)

    1 is simply used for true.

    I think the original shortcode is fine but you didn’t set the required constant in wp-config.php.

    Make sure to check the following 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.

    Thread Starter clancel

    (@clancel)

    I already added the required constant to wp-config.php. I placed it at the end of the template as follows,

    /** Sets up WordPress vars and included files. */

    require_once ABSPATH . ‘wp-settings.php’;

    define(‘PODS_SHORTCODE_ALLOW_EVALUATE_TAGS’,true);

    It is placed in the wp-config.php file found in my website folder. If it’s not placed correctly, please advise. Thank you so much for your help so far.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Not 100% sure (on my phone right now) but I believe it should be above including the settings file.

    Plugin Author Jory Hogeveen

    (@keraweb)

    @clancel
    Is this issue still active or did you manage to fix it?
    Cheers, Jory

    Thread Starter clancel

    (@clancel)

    Hi Jory. Template is now working. I used this shortcode,

    [pods name=”user” where=”id = {@user.id}” template=”User Template”]

    Next thing I wish to do display the special tags in another language. It’s not translating so far.

    Plugin Author Jory Hogeveen

    (@keraweb)

    Hi @clancel

    Please keep this on topic. You already have a different issue opened for that ??
    Closing this issue here.

    Cheers, Jory

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Embedding a user template with a shortcode’ is closed to new replies.