User Avatar Macro

Last modified by Vincent Massol on 2024/07/05 17:54

cogDisplays the avatar of a user, or a standard image noavatar.png if the user has no avatar
TypeJAR
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

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.

userAvatar-editMacro.png

Parameters definition

NameOptionalAllowed valuesDefault valueDescription
usernamenoa stringnoneXWiki 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. Starting with XWiki 3.2 it's now possible to pass just the shortname (i.e. username without the "XWiki." space prefix).
widthyesan integerimage's natural widthThe width of the avatar image
heightyesan integerimage's natural widthThe 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

noavatar.png

Known Issues

  • In XWiki < 4.01 or 4.1-rc-1, there was a bug where referencing users located in subwikis was not working.

Get Connected