Hiding a custom HTML element when user is logged in

(Dylan Damsma) #1

Hi there,

I’m using SSO with Wordpress, but was missing the ‘join’ button on the community, many people didn’t understand how to join the community. So I’ve now added the join button through some custom HTML/CSS. See:


However, the button of course shows even if I am logged in. How can I hide it for logged in users?


(Krischan) #2

This post might help you:

(Simon Cossar) #3

The anon class is added to the html tag when the user isn’t logged in. Try this:

.register-link {
  display: none;

.anon .register-link {
  display: inline;

(STiNGER) #4

Out of curiosity: I assume Discourse itself adds the anon class when there is no user logged in?

(Joe Buhlig) #5

That would be correct.