Viewing 14 replies - 1 through 14 (of 14 total)
  • @blackstar1991

    You can read this UM guide about “Extend the Account page with Ultimate Member pre-defined fields”

    https://docs.ultimatemember.com/article/1770-extend-the-account-page-with-ultimate-member-pre-defined-fields

    Thread Starter Andry

    (@blackstar1991)

    Thanks for answer, and how get this fields if I need them in other page. For example in single.php . (id of user I know)

    @blackstar1991

    You can use this shortcode from the UM Free Extended plugins:

    https://github.com/ultimatemember/Extended/tree/main/um-user-shortcode

    Thread Starter Andry

    (@blackstar1991)

    Hmmm, it dosn’t work for me. I write shortcode [um_user user_id=”1″ meta_key=”country”] https://joxi.ru/eAOjxplCGw3xJ2 https://joxi.ru/5mdZVj0HJ4wkQA (User with ID=1 have field Country https://joxi.ru/J2bLoM9cMxp0yr)

    @blackstar1991

    No for the Account Page you use the code snippet from this page and the shortcode is not required at the Account page.

    https://docs.ultimatemember.com/article/1770-extend-the-account-page-with-ultimate-member-pre-defined-fields

    You can use the shortcode for other pages not being UM pages.

    Thread Starter Andry

    (@blackstar1991)

    I do that. It’s post page. This shortcode does not work for single.php temlate

    @blackstar1991

    Have you tried to include your shortcode in a HTML tag?

    echo '<div>[um_user user_id="1" meta_key="country"]</div>';

    Thread Starter Andry

    (@blackstar1991)

    Yes I did. It dosen’t work for me. The variant with https://joxi.ru/82Qz1oDc4DY5dA doesn’t work nether.

    @blackstar1991

    Can you post here in the Forum how you have inserted the shortcode in the template posts-single.php

    Thread Starter Andry

    (@blackstar1991)

    <?php  echo do_shortcode('[um_user user_id="1" meta_key="country"]'); ?>

    @blackstar1991

    Show “how you have inserted the shortcode in the template” !

    Thread Starter Andry

    (@blackstar1991)

    this is my single.php file in template

    <?php
    get_header();
    $post_id = $post->ID;
    $category = get_the_category($post_id);
    $current_cat_id = $category[0]->cat_ID;
    $current_cat_name = $category[0]->name;
    $category_slug = $category[0]->slug;
    
    $urlDir = get_template_directory_uri();
    
    
    
    
    while (have_posts()) : the_post();
    
        $img = get_the_post_thumbnail_url($post_id);
        $imgMiddle = get_field("middle_img");
        $imgBig = get_field("big_img");
    
        if (!$img) {
            $img = $urlDir . '/images/no-image/min.svg';
        }
        if (!$imgMiddle) {
            $imgMiddle = $urlDir . '/images/no-image/middle.svg';
        }
        if (!$imgBig) {
            $imgBig = $urlDir . '/images/no-image/big.svg';
        }
        $title = get_the_title();
    
    
        $post_author_id = get_the_author_meta('ID');
        $display_name = get_the_author_meta('display_name');
    
    
        $userAva = get_field('user_avatar', "user_" . $post_author_id);
        if (!$userAva) {
            $userAva = $urlDir . '/images/no-image/author-incognito.svg';
        }
        ?>
        <div class="main_wrapper with_aside">
            <main id="post-<?php echo $post_id ?>" class="main post">
    
                <h1 class="post_title"><?php echo $title ?></h1>
    
                <div class="post_figure">
                    <picture class="post_picture">
                        <source media="(min-width: 991px)" srcset="<?php echo $imgBig ?>">
                        <source media="(min-width: 450px)" srcset="<?php echo $imgMiddle ?>">
                        <img class="post_img" src="<?php echo $img ?>" width="320" height="400" alt="<?php echo $title ?>">
                    </picture>
    
                    <div class="post_desc">
                        <time class="time" datetime="<?php the_time('c'); ?>"><?php _e("Опубликовано: ", "");
                            the_time('j F Y') ?></time>
                    </div>
                </div>
    
                <div class="post_box">
                    <div class="post_box__wrapper">
                        <div class="post_box__dignity">
                            <span>Начинающий</span>
                        </div>
                    </div>
                </div>
                <div class="post_country"><?php  echo do_shortcode('[um_user user_id="1" meta_key="country"]'); ?></div>
                <div class="post_user__avatar">
                    <img src="<?php  echo do_shortcode('[um_user user_id="1" meta_key="user_avatar"]'); ?>" alt="Начинающий">
                </div>
                <div class="post_text container">
                    <div class="bl_ceo mb0"><?php the_content();?></div>
                </div>
    
    
            </main>
            <?php if (is_active_sidebar('true_side')) : ?>
                <aside class="aside">
                    <?php dynamic_sidebar('true_side'); ?>
                </aside>
            <?php endif; ?>
        </div>
    <?php endwhile;
    get_footer();
    
    Plugin Support andrewshu

    (@andrewshu)

    Hello @blackstar1991

    You are discussing a third-party plugin with @missveronicatv and this thread has been inactive for a while so we’re going to go ahead and mark it Resolved.

    Regards

    Thread Starter Andry

    (@blackstar1991)

    You misunderstood the task. I need to display plugin values on a standard WordPress page. How get value Country of user on single.php ? *Without using mySQL request of course

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘How user can change fildes in Account page?’ is closed to new replies.