[xwiki-users] using getLocalUser()
Hi... I tried use $xwiki.getUser to get the current user's name but I got a value like this 'com.xpn.xwiki.api.User@13095c7'. So, I looked into the API doc and used getLocalUser() but it does not work. This is the syntax that I used - #set($user = $xwiki.getLocalUser()) $user What is wrong here ? It had given me an output for getUser(). Harikrishnan -- View this message in context: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13624781 Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi, You can get user name with $context.getLocalUser() or users full name with $context.getUser(). Full name means generally containing "XWiki." be fore user name, it's the full name of the document containing the user. 2007/11/7, V. Harikrishnan Nair <[email protected]>:
Hi...
I tried use $xwiki.getUser to get the current user's name but I got a value like this 'com.xpn.xwiki.api.User@13095c7'. So, I looked into the API doc and used getLocalUser() but it does not work. This is the syntax that I used -
#set($user = $xwiki.getLocalUser()) $user
What is wrong here ? It had given me an output for getUser().
Harikrishnan
-- View this message in context: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13624781 Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
If you want a prettier (FirstName LastName) user name you can use $xwiki.getLocalUserName($context.getUser()). 2007/11/7, Thomas Mortagne <[email protected]>:
Hi,
You can get user name with $context.getLocalUser() or users full name with $context.getUser(). Full name means generally containing "XWiki." be fore user name, it's the full name of the document containing the user.
2007/11/7, V. Harikrishnan Nair <[email protected]>:
Hi...
I tried use $xwiki.getUser to get the current user's name but I got a value like this 'com.xpn.xwiki.api.User@13095c7'. So, I looked into the API doc and used getLocalUser() but it does not work. This is the syntax that I used -
#set($user = $xwiki.getLocalUser()) $user
What is wrong here ? It had given me an output for getUser().
Harikrishnan
-- View this message in context: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13624781 Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
-- Thomas Mortagne
:) Thomas had mailed me this (after I had personally mailed him) in reply to my question about removing the hyperlink with the pretty-name of the current user. ---------- In $xwiki you have all theses methods : getUserName(user) getUserName(user, link) getUserName(user, format) getUserName(user, format, link) it seam that in getUserName(user) "link" is true by default so it return you the name with a correct link to access it, if you don't want the link I suppose $xwiki.getUserName($context.getUser(), false) is correct. When you search for api methods the better way is to print the class and then go to javadoc to see the methods in the class. For example for $context you can do $context.class that print you the exact JAVA class and then you go to http://www.xwiki.org/xwiki/bin/download/DevGuide/API/xwiki%2Dcore%2D1.1.1%2D... and click on Context class link to see all methods $context contains. ----------- Thomas Mortagne wrote:
If you want a prettier (FirstName LastName) user name you can use $xwiki.getLocalUserName($context.getUser()).
2007/11/7, Thomas Mortagne <[email protected]>:
Hi,
You can get user name with $context.getLocalUser() or users full name with $context.getUser(). Full name means generally containing "XWiki." be fore user name, it's the full name of the document containing the user.
2007/11/7, V. Harikrishnan Nair <[email protected]>:
Hi...
I tried use $xwiki.getUser to get the current user's name but I got a
value
like this 'com.xpn.xwiki.api.User@13095c7'. So, I looked into the API doc and used getLocalUser() but it does not work. This is the syntax that I used -
#set($user = $xwiki.getLocalUser()) $user
What is wrong here ? It had given me an output for getUser().
Harikrishnan
-- View this message in context: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13624781 Sent from the XWiki- Users mailing list archive at Nabble.com.
_______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
-- Thomas Mortagne _______________________________________________ users mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/users
-- View this message in context: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13641641 Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (2)
-
Thomas Mortagne -
V. Harikrishnan Nair