Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,256,859
Community Members
 
Community Events
164
Community Groups

Custom User Macro to Select Group and Display Member Profiles

Edited

I'm trying to write a user macro that the user can input/select a group and the macro will render the profiles for each of the members of the group. This would allow members to float in and out of the groups without needing to manually update individual user profile macros. I've read and tried to mimic how this was done in several other community posts. This is what I've come up with so far, but it's returning an error while rendering:

 

## Users Pictures for Group - Confluence User Macro
##
## Produces a pile of user profile pictures for members of a specific group
##
## @param Group:title=Group Name|type=string|required=true|desc=The group name


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

#set($userAccessor = $containerManager.containerContext.getComponent('userAccessor'))
#set($groupManager = $containerManager.containerContext.getComponent("groupManager"))
#set($group = $groupManager.getGroup($paramGroup))
#set($users = $userAccessor.getMemberNamesAsList($group) )

#foreach( $username in $users )

#set($confluenceUser = $userAccessor.getUserByName($username))
<ac:structured-macro ac:name="profile">
<ac:parameter ac:name="user">
<ri:user ri:userkey="$confluenceUser.key" >
</ac:parameter>
</ac:structured-macro>
#end

 

Any pointers would be appreciated. 

1 answer

0 votes
Fabian Lim Community Leader Jan 30, 2022

Hi @Kmmaughs

Have you been able to figure out a solution for this one?  I'm interested.

Thanks

Unfortunately, no :( I sort of gave up on the effort, so we manually manage users profiles. 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence Cloud

Presenter Mode for Confluence is here 🖥 👩‍💻

👋  Hello Community!  My name is Stephanie Zhang, and I’m a product manager on the Confluence cloud team. Today, I’m excited to announce the rollout of  Presenter Mode : a ...

2,322 views 19 41
Read article

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