Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

user-macro : get details from user parameter

Klaas Chielens
Contributor
March 5, 2022

I'm trying to make a user macro where one of the parameters is the user name. 

So I have " ## @Param User:title=User|type=username " to get this name as a parameter. Now I'd like to use this to get the full name / user profile picture / ... from this specific username. Is there a way to do this?

Thanks

1 answer

1 accepted

0 votes
Answer accepted
Bill Bailey
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 5, 2022

I haven't played with this for awhile, so some of the details are hazy, but this should get you started down the right path:

## Macro title: User Name to Userkey plus display conversion macro
## Developed by: Bill Bailey, MarketCom, LLC
## Date created: 2018.07.19
## Version: 0.19

## @param User:title User Name|type=username

<div class="content-wrapper">
<p>
<ac:link>
#set($userInfo = $userAccessor.getUserByName("$paramUser"))
<ri:user ri:userkey="$userInfo.key"/>
</ac:link>
</p>
</div>

 

And another example of pulling user data:

## Macro title: User Data Macro Test
## Developed by: Bill Bailey, MarketCom, LLC
## Date created: 2019.03.04
## Version: 0.9

## @noparams

#set($currentUser= $action.authenticatedUser)
#set($groups = $userAccessor.getGroupNames($currentUser))

<table>
<colgroup>
<col/>
<col/>
</colgroup>
<tbody>
<tr>
<th>Item</th>
<th>Value</th>
</tr>
<tr>
<td>User Name</td>
<td>$currentUser.fullName
</td>
</tr>
<tr>
<td>Is an admin</td>
<td>$permissionHelper.isConfluenceAdministrator($currentUser)
<br/>
</td>
</tr>
<tr>
<td>Group memberships</td>
<td>$groups
</td>
</tr>
<tr>
<td>Is a member of publisher</td>
<td>$groups.contains("publishers")
</td>
</tr>
</tbody>

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events