إضافة زر وضع مجهول مخصص

يمكن تحقيق ذلك باستخدام منفذ إضافة وإضافة بعض قوالب Handlebars (تم تغطية هذه المفاهيم في Developing Discourse Themes & Theme Components)

في نسختك (الإدارة > تخصيص > النسخ > تعديل CSS/HTML)، يمكنك إضافة هذا إلى ملف </head> الخاص بك.

<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>