Add custom anonymous mode button

can you tell me how can i moving my anonymous button like the pic


Thanks

1 Like

This can be done by using a plugin outlet and adding some handlebars (these concepts are covered in Developer’s guide to Discourse Themes)

In your theme (admin > customize > themes > edit CSS/HTML), you can add this to your </head> file.

<script type="text/x-handlebars"  data-template-name="/connectors/above-main-container/anon-button">
{{#if this.currentUser}}
  {{#if this.currentUser.is_anonymous}}
    {{d-button class="btn-primary" action=(route-action 'toggleAnonymous') icon="ban" label="switch_from_anon"}}
  {{else}}
    {{d-button class="btn-primary" action=(route-action 'toggleAnonymous') icon="user-secret" label="switch_to_anon"}}
  {{/if}}
{{/if}}
</script>

Screen Shot 2019-12-12 at 2.03.57 PM

9 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.