Access ConfluenceUserProfile in macros

Does anyone know if its possible to get a reference to the ConfluenceUserProfile class (com.atlassian.sal.confluence.user.ConfluenceUserProfile) in a macro?

2 answers

1 accepted

0 votes
Answer accepted

Hi Matt,

Accessing the user profile macro in a velocity template would look like this:


For XHTML like this:

<ac:macro ac:name="profile">

    <ac:parameter ac:name="user">admin</ac:parameter>


To access from a user macro, you could do a modification of this tutorial:

by accessing the methods you would like from the class:

Hope this helps!

Thanks for the response. I was actually trying to get at a specific method on the ConfluenceUserProfile class, but found a way to access it via a different class in my macro.

Glad you were able to figure it out. Please share your solutions if possible so others looking for Answers can bask in your Guru-ness :)

Well, I was trying to get the profile picture for the creator of a blog post so that I could add a little "About the author" section on each new blog entry (without the author having to do anything).

Turns out I missed the method I needed when first looking over the User class, but it's right there.

In the blog page decorator, you can use the following to get the user profile picture:

## getUser returns an object of type User
#set($blogWriter = $userAccessor.getUser($page.getCreatorName()))
## getUserProfilePicture returns an object of type ProfilePictureInfo
#set($pic = $userAccessor.getUserProfilePicture($blogWriter))
#set($picPath = $pic.getDownloadPath())

Hi Matthew,

Do you mean get a user profile to show up on a page, or in another macro? Is this something you're trying to do programmatically?

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 12, 2019 in Confluence

Confluence Admin Certification now $150 for Community Members

More and more people are building their careers with Atlassian, and we want you to be at the front of this wave! Important Dates Start the Certification Prep Course by 2 April 2019 Take your e...

1,157 views 2 13
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you