User Avatar Macro
Last modified by Thomas Mortagne on 2026/02/26 15:38
| Displays the avatar of a user, or a standard image noavatar.png if the user has no avatar |
| Type | JAR |
| Category | |
| Developed by | |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
| Bundled With | XWiki Standard |
Table of contents
Description
Displays the avatar of a user, or a standard image noavatar.png if the user has no avatar. A user's avatar is a url that is defined by editing a user's profile.
Usage
Wiki Syntax
{{useravatar username="<username>" /}}WYSIWYG Editor
When inserting the User Avatar macro from the WYSIWYG editor you can select the user with the user picker.
![]()
Parameters definition
| Name | Optional | Allowed values | Default value | Description |
|---|---|---|---|---|
| username | no | a string | none | XWiki user of the form "wiki:XWiki.UserName". Note that the wiki part is optional and should be used when using XWiki in multiwiki mode and you wish to reference a user located in another subwiki. |
| width | yes | an integer | image's natural width | The width of the avatar image |
| height | yes | an integer | image's natural width | The width of the avatar image |
Example
The avatar of some XWiki.JohnDoe user:
{{useravatar username="XWiki.JohnDoe" width="40" height="40"/}}The avatar of some XWiki.JohnDoe user located in a subwiki named somewiki:
{{useravatar username="somewiki:XWiki.JohnDoe" width="40" height="40"/}}Result
![]()
Known Issues
- In XWiki < 4.01 or 4.1-rc-1, there was a bug where referencing users located in subwikis was not working.