The forum of the forums

Would you like to react to this message? Create an account in a few clicks or log in to continue.
The forum of the forums
2 posters

    Forum Chatbox Permissions

    avatar
    Major_John
    New Member


    Posts : 1
    Reputation : 1
    Language : English

    In progress Forum Chatbox Permissions

    Post by Major_John Sat Feb 28, 2015 1:20 am

    Hello, I have seen it done on other forumotion forums but I am unsure how to replicate it. How do I make the chat box only available/visible to certain groups/special ranks (ie admins) and not everyone?
    Ange Tuteur
    Ange Tuteur
    Forumaster


    Male Posts : 13207
    Reputation : 3000
    Language : English & 日本語
    Location : Pennsylvania

    In progress Re: Forum Chatbox Permissions

    Post by Ange Tuteur Sat Feb 28, 2015 1:02 pm

    Hello @Major_John,

    Give the following a try. First go to Administration Panel > Display > Colors > CSS stylesheet and paste the following code.
    Code:
    body.chatbox, #chatbox_top { display:none }


    Then go to Modules > JavaScripts codes management and create a new script.

    Placement : In the homepage
    Paste the following code and submit :
    Code:
    $(function() {
      var fa_chat = document.getElementById('frame_chatbox'), top = document.getElementById('chatbox_top'), frame;

      if (_userdata.user_level == 1) {
        top.style.display = 'block';
        fa_chat.onload = function() {
          if (fa_chat.contentDocument) frame = fa_chat.contentDocument;
          else frame = fa_chat.contentWindow.document;
          frame.body.style.display = 'block';
        };
      } else top.parentNode.style.display = 'none';
    });

    This will allow you to hide the chatbox from non-administrators, and show it for admins on the index. You wont be able to see the chatbox by going to the direct link unfortunately.

    If you want to display the chatbox for both moderators and admins, replace _userdata.user_level == 1 by _userdata.user_level

      Current date/time is Sun Sep 22, 2024 10:25 pm