Home Forums Plugin Support WP User Frontend Pro Registration Custom Fields not displaying

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  rfarmer 6 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #2619

    rfarmer
    Participant
    Post count: 13

    I have some custom fields for my Registration Form and I want to display those on my theme's ‘author.php' page. I cannot get them to display the data using the syntax from the documentation. Is there a different treatment for registration form custom fields? I can get it working fine for regular forms on posts.

    <?php get_header(); ?>

    <?php $show_sidebar = (get_option(‘thestyle_sidebar') == ‘on') ? true : false; ?>

    <h3>Location</h3>

    <?php echo get_post_meta( $post->ID, ‘location', true ); ?>

    <h3>Website</h3>

    <a href=”<?php echo get_post_meta( $post->ID, ‘user-website', true ); ?>”><?php echo get_post_meta( $post->ID, ‘user-website', true ); ?></a>

    <div id=”content” class=”clearfix<?php if ($show_sidebar && get_option(‘thestyle_blog_style') == ‘false') echo(‘ sidebar-fixedwidth'); ?>”>

    <div id=”boxes” class=”<?php if (!$show_sidebar) echo(‘fullwidth'); if (get_option(‘thestyle_blog_style') == ‘on') echo(‘ blogstyle-entries'); ?>”>

    <?php get_template_part(‘includes/entry'); ?>

    <?php get_footer(); ?>

     

    http://cookiehound.iwantedryanfarmer.com/author/testnametwo/

    #2620

    Tareq Hasan
    Keymaster
    Post count: 2831

    `get_post_meta()` is for posts, `get_user_meta()` is for registration or users custom field.

    One more thing, `$post->ID` refers to the post ID, where for authors profile, you need to get the user ID. To get the current users ID, add this code after `get_header()`:
    [php]
    <?php
    $curauth = (get_query_var(‘author_name')) ? get_user_by(‘slug', get_query_var(‘author_name')) : get_userdata(get_query_var(‘author'));
    ?>
    [/php]

    Now you can show the user location like this
    [php]<?php echo get_user_meta( $curauth->ID, ‘location', true ); ?>[/php]

    #2621

    rfarmer
    Participant
    Post count: 13

    Perfect. Thank You!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Registration Custom Fields not displaying’ is closed to new replies.