Hi, The condition is: After user has registered he/she only belongs to XWikiAllGroup (right?) If this condition is true; we would like to ask the user to 'tell us more about yourself' by re-directing to the profile Updating the userprofile with extra data; with this data we can then add the user to appropriate group(s)
I understand : the $query will give all groups in the wiki except XWikiAllGroup In the foreach you add 1 to the counter for each group the user is extra in? So if the counter > 0 the user belongs to extra group so should NOT be redirected if the counter still == 0 then the redirect should happen? The login.vm seems indeed to be the place to be, I prefer to copy the vm into my skin, so I will override the login.vm on the disk Op 24 okt 2010, om 22:47 heeft [Ricardo Rodriguez] eBioTIC. het volgende geschreven: Hi, Gerritjan Koekkoek wrote: > Hi, > > The script works fine; > One modification required (#if($counter > 0) ==> #if($counter == 0) > I'm afraid I don't understand the condition yet! :-( Do you want that any user belonging to any group but XWikiAllGroup is redirected to his/her profile? Or should be only XWikAllGroup members whom must be redirected to his/her profile page? Just trying to understand why do you need == instead o >. Thanks! > But this only works when user login is on homepage, in our use cases there > are also other pages where a guest can decide to login > Is there a vm script that is always triggered when user does login? > > OK! I've not taken this into account! login.vm in your /templates folder seems to be the right place to tweak. > Gerritjan > > Op 24 okt 2010, om 01:52 heeft [Ricardo Rodriguez] eBioTIC. het volgende > geschreven: > > Hi, > > Gerritjan Koekkoek wrote: > >> Hi, >> >> We would like to, conditionally, redirect users who log in to their profile >> page. (in our case; XWiki.<username>) >> The condition is: User is not in ANY OTHER GROUP then XWikiAllGroup. >> >> How can I do this most elegantly, modifying as little as possible of the >> standard pages that come with a distribution of XWIKI >> >> >> >> > This is not elegant, but I think it works: > > #set($counter = 0) > #set($user = $xwiki.getUser()) > #set($userContext = $context.user) > > #set($query = ", BaseObject as obj, StringProperty as prop where > doc.fullName = obj.name and obj.className='XWiki.XWikiGroups' and > doc.fullName <> 'XWiki.XWikiGroupTemplate' and doc.fullName <> > 'XWiki.XWikiAllGroup' order by doc.fullName asc") > > #set($results=$xwiki.searchDocuments($query)) > <p/> > #foreach($item in $results) > #if($user.isUserInGroup($item)) > #set($counter = $counter+1) > #end > #end > > #if($counter > 0) > $response.sendRedirect($xwiki.getURL($userContext)) > #end > > You could copy and paste in your WebHome or create an ad hoc document > and use #includeInContext('YourSpace.YourDocument') to include it in > your WebHome. > > HTH, > > Ricardo > > Greetings! -- Ricardo RodrÃguez CTO eBioTIC. Life Sciences, Data Modeling and Information Management Systems _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users