Forums

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

Confluence user group macro

Heshan Manamperi
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.
November 27, 2014

Below macro shows all the groups and its members in confluence. But it shows disabled users too. How do I remove them from this macro?

 

## @noparams
$body


#foreach ($group in $userAccessor.getGroupsAsList())
#if (($group != 'jira-users')
)
##set ( $groupString = $group )
##set ( $groupObject = $userAccessor.getGroup($groupString) )
#set ( $memberList = $userAccessor.getMemberNamesAsList( $group ) )

<table class="confluenceTable">
<tr>
<th class="confluenceTh">$group </th>
</tr>

#foreach ($member in $memberList)
<tr>
<td class="confluenceTd">#usernameLink($member)</td>
</tr>
#end
</table>
#end
#end

1 answer

1 accepted

0 votes
Answer accepted
Stephen Deutsch
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.
November 27, 2014

Hi Heshan,

maybe try this?

## @noparams
#foreach ($group in $userAccessor.getGroupsAsList())
  #if ($group != 'jira-users')
    #set ( $memberList = $userAccessor.getMemberNamesAsList( $group ) )
    &lt;table class="confluenceTable"&gt;
      &lt;tbody&gt;
        &lt;tr&gt;
          &lt;th class="confluenceTh"&gt;$group &lt;/th&gt;
        &lt;/tr&gt;
        #foreach ($member in $memberList)
          #if (!$userAccessor.isDeactivated($member))
            &lt;tr&gt;
              &lt;td class="confluenceTd"&gt;#usernameLink($member)&lt;/td&gt;
            &lt;/tr&gt;
          #end
        #end
      &lt;/tbody&gt;
    &lt;/table&gt;
  #end
#end
Heshan Manamperi
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.
November 27, 2014

It works. Thanks Stephan. :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events