Re: [xwiki-devs] using getLocalUser()
Would be better to send mail on mailing list and not directly to me :) Anyway 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. 2007/11/7, [email protected] <[email protected]>:
Sorry for disturbing you again, Thomas. I am getting the pretty-name using the way you told me. But it does not return the name as a plain string. It is a hyperlink to a page of that name (name of the user). Is there any method to get rid of that link ? Can something like typecasting be done here ?
Thanks, Hari
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
Quoted from: http://www.nabble.com/using-getLocalUser%28%29-tf4763863.html#a13625001
-- Thomas Mortagne
participants (1)
-
Thomas Mortagne