Get user avatar to display on page they created

Dcode warner asked on March 17, 2017 21:14

How can I get the current page NodeOwner 'user picture', 'user signature' and 'description.' [screenshot] http://prntscr.com/el8mcn

This returns a default avatar image. {% GetUserAvatarImage(200, "Alternate text") %}

I need it to grab the avatar of the person who created the page(NodeOwner).

Correct Answer

Trevor Fayas answered on March 18, 2017 16:18

While the ASCX tranformation has a an option to input the user ID, doe'snt look like the macro method does.

The Avatar link is just a link using the user's GUID, here's what you can do

<img alt="Avatar" src="/CMSPages/GetAvatar.aspx?avatarguid={% GlobalObjects.Users.Where("UserID = "+ToInt(NodeOwner, -1)).FirstItem.UserGUID %}" />

1 votesVote for this answer Unmark Correct answer

Recent Answers


Alberto Pellanda answered on March 21, 2017 09:18

In Kentico 10 I use this code in K# transformations and it works well:

<img src="{% GetUserAvatarImageUrl(UserAvatarID, UserID, 150, 100, 150) %}" alt="{% HTMLEncode(GetUserFullName(UserID)) %}" class="img-responsive">

I think you can replace UserAvatarID with null and UserID with NodeOwner like this:

<img src="{% GetUserAvatarImageUrl(null, NodeOwner, 150, 100, 150) %}" alt="{% HTMLEncode(GetUserFullName(NodeOwner)) %}" class="img-responsive">
0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.