Forums

User Meta
[resolved] How do I get the new meta fields to show up on the author page? (3 posts)

  1. salsa23
    Member
    Posted 1 year ago #

    How do I get the new meta fields to show up on the author page?

    I set up an author.php file with the standard template from this page, just to get it to show.

    http://codex.wordpress.org/Author_Templates

    I see that I have to add

    # $curauth->first_name;
    # $curauth->ID;
    # $curauth->jabber;
    # $curauth->last_name;
    # $curauth->nickname;
    # $curauth->user_email;

    Problems:

    1. I have no idea what the curauth for the new files I added are

    2.I have no idea how to add this to the php file?

    Hope someone can help.

    Thanks.

    http://wordpress.org/extend/plugins/user-meta/

  2. Atlanta
    Member
    Posted 1 year ago #

    Wouldn't it be the meta key that you created in admin>user meta> user extra field

  3. khaledsaikat
    Member
    Plugin Author

    Posted 1 year ago #

    For retrieving extra data for any user:
    $user_data = get_userdata( $user_id );

    if your new meta key is country_name, then use:
    $user_data->country_name;

    To retrieving extra data for current user:
    global $user_ID;
    $user_data = get_userdata( $user_ID);
    echo $user_data->first_name;
    echo $user_data->country_name; // ( suppose country_name is newly created meta_key)

    Get data by get_user_meta():
    http://wordpress.org/extend/plugins/user-meta/ plugin save extra data to usermeta table. so you can use get_user_meta() function.

    $country = get_user_meta( $user_id, 'country_name', true);
    ( suppose country_name is newly created meta_key)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags