How to get user details (Phone, Position, etc) for macro in Confluence?

Hi everybody,

Starting from the last succefull login macro from Andrew Frayling and from the macro that produces a list of users last login date from Remo Siegwart i want to create a macro that will also take personal details from every user like Phone, Position etc in order to create a report.

Any idea how i can take the personal details?

Thanks in advance,


4 answers

1 accepted

4 votes
Accepted answer

I think I have an answer for you, not sure if this is the quickest route but it does the job.

Use your findings in macro that produces a list of users last login date and get another component:

#set($userDetailsManager = $containerContext.getComponent('userDetailsManager'))

You print user details like this:

$userDetailsManager.getStringProperty($action.remoteUser, 'location')

You can even get them by group and iterate using:


And lastly, you could load a wiki markup renderer for personal information (about me) user field. This thing was a real pain for me. Check out my findings:

it worked !! :)

Hey Andreas,

Thanx for your help.

I'm getting the component below

#set($userDetailsManager = $containerContext.getComponent('userDetailsManager'))

but i don't know how to print user details for all users.

The macro that i have is:

#set($userDetailsManager = $containerContext.getComponent('userDetailsManager'))
#set($loginManager = $containerContext.getComponent('loginManager'))
#set($group = $userAccessor.getGroup($paramgroup))
    #set($usernames = $userAccessor.getMemberNames($group))
    <table class="confluenceTable">
			<th class="confluenceTh">Count</th>
            <th class="confluenceTh">User</th>
			<th class="confluenceTh">Tel</th>
			<th class="confluenceTh">Groups</th>
            <th class="confluenceTh">Last Successful Login Date</th>
			#set($count = 0)
			#foreach($username in $usernames)
            #set($user = $userAccessor.getUser($username))
			#set($groups = $userAccessor.getGroupNamesForUserName($


			#set($count = $count + 1)
			<td class="confluenceTd">$count</td>
			<td class="confluenceTd">#usernameLink($</td>
			<td class="confluenceTd">$userDetailsManager.getStringProperty($userAccessor.getUser($username)), 'location')</td>
			<td class="confluenceTd">$groups</td>
			<td class="confluenceTd">$action.dateFormatter.formatDateTime($loginManager.getLoginInfo($user).lastSuccessfulLoginDate)</td>
    <p><i>No group with name "$paramgroup" found!</i></p>

If i use

$userDetailsManager.getStringProperty($userAccessor.getUser($username)), 'location')

doesn't print anything.

If i use

$userDetailsManager.getStringProperty($action.remoteUser, 'location')

prints the location of currently logged in user for every use.

I have use various combinations without success.

Any idea?

Thanx again for the help patrioti :)



Andreas i've pressed on i don't like this post by mistake. I'm trying to undo the action and i have a warning that an error occurs. I'll try to undo it.

I found the solution with your help.



Haven't tried to iterate user objects, some suggestions:

Does your loop works? Where do you place the line to get the user's property? If you have the $user, try using it to get its properties, instead of userAccessor.getUser().


Hey andreas,

Macros work fine. The down vote was by mistake.

The problem with undo down vote is not resolved yet. I have raised an issue to atlassian

Kala Christougenna,


No worries Kosta,

Merry Xmas kai KALH XRONIA - Happy new year !!


Unless you can access the client through a mobile API, I don't think you can get the position (I assume you mean the GPS coordinates of the requesting device) from Confluence. You could use an analytics tool to give you general location-based information about clients, such as country of origin.

As for "Phone", I assume you mean the type of client device used to access the page. You can use JavaScript to get the clienty type (which would be the browser, which would hint at the phone type), but I don't think you can get the type of phone, again, without accessing a mobile API.

I think he means the user details stored in the confluence user profile.

Yeap. Maybe i didn't make it so clear but i need the details of user profile.

Check out the following two managers:

* com.atlassian.confluence.user.PersonalInformationManager
* com.atlassian.confluence.user.UserDetailsManager


I have the same issue patrioti, need to get the "About Me" field from the user.

David said the trick is to get to the UserDetailsManager object, which is not one of the Confluence Objects Accessible From Velocity. (David says)

Check out his answers in the cases below, a bit tricky, need to have confuence source, eclipse or some other IDE - and go figure.

My problem is with velocity, you can get the userAccessor but then, what route do you follow to get to the userDetailsManager :
$action.getUserAccessor()..?... getEditMyProfileAction().getUserDetailsMap().getProperty('website')

Something like this maybe:

.. doesn't work either :/

Maybe, you can get something out of his comments and share it with us

Case 1:

Case 2:

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Dec 18, 2018 in Confluence Cloud

Happy holidays from our team to yours!

Hi Community!  2018 was filled with changes for our team, both big and small, and we've taken a lot of time to both celebrate our wins and recognize areas of improvement. One thing that we're a...

469 views 3 18
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