Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Protected channels (only moderators' posts)
(function($){
$(function(){
//on domready
muut(function(app){ //on forum load
//retrieve DOM element
var createInput = $('.m-form.m-create');
var only_admin_channels = ['Your Channel 1', 'Your Channel 2']; // list of channel-titles
var is_moderator = app.is_signed && app.user.is_admin;
//on load and update events
app.on('load update', function (_, e) {
//if channel page and not a moderator and protected channel
if(e.type == 'page' && !is_moderator && -1!==$.inArray(e.title, only_admin_channels)){
createInput.hide();
}else{
createInput.show(); //this won't collide with 'display: none !important'
}
});
});
});
})(window.jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.