Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Macro to get User ID along with Full Name and Login Activity

We're using below macro to dynamically get the list of users in our Confluence and report their activity. It's working pretty well.

The only problem is the full name isn't helping us.

We sometimes perform lookups with other data we generate from LDAP. As our confluence is linked to LDAP having a Confluence user login ID instead of the name helps us a lot. Right now below is the block of code in our Confluence user reporting macro.

## @noparams
#set($containerManagerClass = $content.class.forName('com.atlassian.spring.container.ContainerManager'))
#set($getInstanceMethod = $containerManagerClass.getDeclaredMethod('getInstance',null))
#set($containerManager = $getInstanceMethod.invoke(null,null))
#set($containerContext = $containerManager.containerContext)

#set($loginManager = $containerContext.getComponent('loginManager'))
#set($crowdService = $containerContext.getComponent('crowdService'))
#set($users = $userAccessor.getUsers())

<table class="confluenceTable">
<th class="confluenceTh">User</th>
<th class="confluenceTh">Last Successful Login Date</th>
<th class="confluenceTh">Creation Date</th>
<th class="confluenceTh">Active</th>
#foreach($user in $users)
#set($crowdUser = $crowdService.getUser($
<td class="confluenceTd">#usernameLink($</td>
<td class="confluenceTd">$action.dateFormatter.formatDateTime($loginManager.getLoginInfo($user).lastSuccessfulLoginDate)</td>
<td class="confluenceTd">$action.dateFormatter.formatDateTime($crowdUser.createdDate)</td>
<td class="confluenceTd" style="text-align:center;">
<img src="/s/en_GB/3047/11/_/images/icons/emoticons/error.png" width="18" height="18" border="0">
<img src="/s/en_GB/3047/11/_/images/icons/emoticons/check.png" width="18" height="18" border="0">

I need some help with the below line to generate Confluence user id instead of user's name.

<td class="confluenceTd">#usernameLink($</td>


Thanks in advance.

0 answers

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

462 views 24 9
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you