Userprofile page hidden by default when creating new user

I would like userprofile page automatically be created as hidden when creating new user.

What would be the easiest way to implement this?

By creating an EventListener listening to DocumentUpdatingEvent and setting the doc to hidden in it.

thanx, I created event listener on DocumentCreatingEvent and DocumentUpdatingEvent with this onEvent code

{{velocity}}
#set($docSource = $xcontext.method.input.get(1))
#if ($docSource.getObject('XWiki.XWikiUsers'))
  #set($discard = $docSource.setHidden(true))
#end
{{/velocity}}

However it does work for document update, but doesnt work when the user is created via selfregistration form. Can it be because the XWiki.XWikiUsers might not exist yet when the event is triggered? Any clues?

so even without IF condition the code was not executed.

It looks like no events are triggered when user is created using $wiki.createUser (which is called from registration form), bug probably? (v12.9)

Tried both DocumentCreatingEvent and DocumentCreatedEvent and it works ok for manually created pages, but not for those within registration.

Hi. I can see at xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java at 4b9e54a700baf31e4659ae8c3c1a22d261214d53 · xwiki/xwiki-platform · GitHub that saveDocument() is called. And that method calls xwiki-platform/xwiki-platform-core/xwiki-platform-oldcore/src/main/java/com/xpn/xwiki/XWiki.java at 4b9e54a700baf31e4659ae8c3c1a22d261214d53 · xwiki/xwiki-platform · GitHub which sends the event.

Maybe you could debug it with an IDE to see why it’s not called in your case?

Note to self: Introduce new events for user creation. I’ve just created Loading...

Thanks