Xwiki中的用户信息

时间:2018-07-26 06:54:05

标签: velocity xwiki

我想从Xwiki中的用户个人资料中获取名字和姓氏等信息。该怎么办? 谢谢。

1 个答案:

答案 0 :(得分:0)

只需使用(例如Velocity)Scripting API即可获取用户的个人资料页面,并从该页面中提取用户对象,该页面中所有用户数据都位于该页面中。有兴趣:

{{velocity}}
#set ($userDoc = $xwiki.getDocument('XWiki.someUserName'))
#set ($userObj = $userDoc.getObject('XWiki.XWikiUsers'))
## Get some properties
#set ($firstName = $userObj.getValue('first_name'))
#set ($lastName = $userObj.getValue('last_name'))
#set ($email = $userObj.getValue('email'))
##...etc
## Display the properties in the page
**First Name**: $firstName
**Last Name**: $lastName
**Email**: $email
{{/velocity}}