I would like to hide a button only for the unregistered people on my Xwiki website but I really don’t find how to do it. Indeed I would like to create a style sheet extension to hide this button but it should be applied only for certain users or groups.
Hi @STG,
An unregistered user is considered as being the XWiki.XWikiGuest. You can check in velocity the value of the current user with the $xcontext.user call. You can do:
First of all thanks for your answer.
Indeed this velocity code works to display things for certain users.
However I don’t know how to adapt it in order to hide a specific button. Indeed I have tried to “take” the name of the existing button with the developer tools and use it in this code :
Hello, I can only add to above mentioned code, it depends on how you’d prefer to write it, you can also create custom CSS rule or JS code as seprate document. And call it in the if statement for CSS call #set($discard = $xwiki.ssx.use($doc.fullName)) or if you’ve manipulated style via JS ($discard = $xwiki.jsx.use('$doc.fullName')). More about it can be found here - XWiki Skin.
As I think about your question I get the idea that you would probably like to do more than just hide a button. Maybe not as of yet but probably in the future more things will pop up, things of which you would like to style based on the user profile.
Therefore I suggest you could create (at least) two different stylesheets.
Based on the answers given already you can add this code on top of your page where you want to present this difference between the user profiles.