Hi,
If you are just trying to determine whether a name is available
for a user registration you can use:
#set($userName = "Admin")
#if($xwiki.exists("XWiki.$userName"))
    Username $userName is not available.
#end

This method will throw false positives for documents in the XWiki space.
eg:
#set($userName = "TagClass")

To be absolutely sure, you need to double check that the document you are
getting actually has an object of the class XWiki.XWikiUsers

#set($userName = "Admin")
#set($user = $xwiki.getDocument("XWiki.$userName"))
#if($user.isNew() || !$user.getObject("XWiki.XWikiUsers"))
    The user named $userName does not exist.
#else
    The user named $userName exists.
#end


Good luck.

Caleb James DeLisle


J. Allen Q. Santos wrote:
> Hi!
> 
> Given a username, how do I know if a user with that username is already
> registered? Is there a way to check, say isUserRegistered(username) or
> User.isUserRegistered()?
> 
> Thank you very much.
> 
> -Allen
> 
> 
> By the way, HAPPY NEW YEAR!
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.xwiki.org/mailman/listinfo/users
> 

_______________________________________________
users mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to