Help! with the Anonymous feature on discourse

Hello, everyone, I am new to the discourse platform and I’m currently building a bottom bar navigation that will only be displayed on mobile phones and I cannot seem to get the anonymous feature to work, I want to make an icon on my bottom bar function like the anonymous icon on discourse. I cannot seem to figure this out.

This is the code that runs in the user menu to switch to an anonymous account

https://github.com/discourse/discourse/blob/a48abc6556bcdaec07f9f32e117abfd6799bd2f1/app/assets/javascripts/discourse/routes/application.js.es6#L28-L30

You need to replicate that code when the anonymous button is clicked. How you do that will depend how you’ve implemented the bottom bar.

5 Likes

Hi, @david I am trying to implement it as a button on mobile, here is what my HTML code looks like;

    <ul class="bottom_nav_menu">
            <li class="ze_menu_bottom">
                <a class="toggle-anon enable-anonymous" alt="Go Anonymous">
                    <i class="material-icons">&#xE8F5;</i><span class="text"> Go Anonymous </span>
                </a>
            </li>
        </ul>