Displaying fields per user

Greetings,

So I have created an author.php page in correspondence with this page: https://s2member.com/kb-article/s2member-profile-shortcode/ and I want certain fields to be displayed on this author page. The author.php page is part of my child theme.
At the beginning of the author.php page I begin with

$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author));

When I call the standard bio field in WP with this: echo $curauth->user_description;
I get what I want.

However, when I do the same for S2 in this case: echo $shortbio = get_user_field(‘shortbio’);
I get the same of the user that is logged in…

Now I know I am pretty close but would appreciate someone helping me out with this :slight_smile:

Thnx!

You’re missing the user’s ID in get_user_field, so it defaults to the current user. https://www.s2member.com/codex/stable/s2member/api_functions/package-functions/#src_doc_get_user_field()

Maybe something like this?

$shortbio = get_user_field(‘shortbio’, $curauth->ID);

:slight_smile:

1 Like

And there it is, right in front of me :slight_smile: Thank you :slight_smile: I completely forgot to look at the API section.

1 Like

Happens :wink:

1 Like