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
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>
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.