Sidebar widgets don't show up to anonymous users?


  • @psychobunny

    Check out ye old footer. See any widgets? I don't when anon, but who knows. When logged in, got two widgets down there.

  • Admin

    Yup, when logged in I see shoutbox and forum stat widgets. So these are unchecked for anonymous as well? Your original issue was:

    But this only only applies to sidebar widgets, not header or content widgets.

    So I'm wondering what's up, because I saw the Ask widget on the sidebar. My guess is that - perhaps - anything that has been set for anonymous at some point in the past is unable to revert?


  • @psychobunny

    Interesting theory...but I've checked and unchecked all the widgets and only the ask widget shows up. I don't remember if I meant "footer widget doesn't show up" in the original question, or if I was just high.

    I'm glad that the ask widget remains visible though, so no big deal. Although I'd like for people to click on the ask button and get a message "log in ya dummy".

  • Admin

    Add this in:

    if (!app.uid) {
      app.alertError('Log in ya dummy');
    }
    

  • @psychobunny

    Cool! Except it pops up without clicking the button, and doesn't pop up when clicking the button. I stuck the code before </script>. Do I put it somewhere else?

  • Admin

    I don't remember how the code looks like, but you'd have to stick that inside something that looks like:

    someButton.on('click', function() {
        <--- put it here
    });
    

    If you're stuck just paste the whole thing and I'll write the proper way


  • @psychobunny

    Close, now it shows the error plus the composition window at the same time. Here's the code, is there an "else" type statement I need?

    <script>
    $('#new-topic-button-widget').on('click', function() {
    
    if (!app.uid) {
      app.alertError('Log in ya dummy');
    }
        
    require(['composer'], function(composer) {
            composer.newTopic(2);
        });
    });
    
    </script>
    
  • Admin

    Yup. Final code is:

    <button id="new-topic-button-widget" class="btn btn-primary">Post</button>
    <script>
    $('#new-topic-button-widget').on('click', function() {
    	if (!app.uid) {
    	  app.alertError('Log in ya dummy');
    	} else {
    		require(['composer'], function(composer) {
    	        composer.newTopic(2);
    	    });
    	}
    });
    </script>
    

    Now you're learning JS too ๐Ÿ˜› next stop, build your own plugins ๐Ÿ˜„


  • @psychobunny

    Yay!

    It's been a while with programming. In 1995 I made a Connect 4 game using Turbo Pascal, and apparently that took so much out of me I couldn't program ever again. But if anything would make me get back to learning, it's NodeBB ๐Ÿ‘


  • Is this still an issue? I have just noticed that non of the sidebar widgets display to anon users.

    Edit- nvm i think it is a theme issue.

Suggested Topics

  • 10
  • 11
  • 9
  • 1
  • 2
| |