Sign Up! Login: Password: New User? Forgot? Support
Code 
 
 
Forums 
Forums : Forums > Locking a Forum
Mottie (SuperAdmin) 2/2/2010 4:31 PM EST : Locking a Forum
ACK!
Mottie
Posts: 3884

0
Like

0
Dislike

Locking a Forum

GuildPortal admin site link to the original post

This script allows you to either remove or fade out forum controls that allow users to add a topic to a forum or post replies in a forum. So essentially all it does is locks out the controls. If someone knows how to get to the editor and get to that specific topic then they can edit/modify the post. So this method is not 100% effective, but it'll make it difficult for non-technical users to add a post.

Important Notes:
  • When adding this script, add it to a Free Form Text/HTML type widget on your forum page - add it while the editor is in <> HTML mode AND in Raw/Script mode. because there are 2 <script> tags, the editor will strip out the second one. Or, just add it to the Footer Area (Control Panel > Custom HTML & Script > Footer Area).
  • The CSS styling at the beginning of code hides all the buttons, this would only be a problem for users that have javascript disabled. These people will never see the buttons. If you remove this CSS, the button may flash - normal, then faded or removed by the script. If someone catches the button while it's normal they may be able to post. So, I'll leave it up to you to include this CSS or not.
  • The reply, quote, edit and delete buttons under each post have their tooltip replaced. But because the tooltip is added dynamically, you'll need to include the tooltip script posted here (if you haven't already done so).
  • There is no indicator in the forum title that shows a forum has been locked, I may look into adding an icon or message after the title.
Disabled
Add
Topic
Button
 
 
Disabled
Post
Reply
Buttons
 
Code (minimal setup)
<!--
**********************************************
 Locked Forums
********************************************** -->

<style type="text/css">
/* hide Add Topic Link */
#ctl00_ContentPlaceHolder1_ctl01_lnkAddTopic { display: none; }
/* hide Message tools (reply edit and delete links) */
.MessageToolsCell1 { display: none; }
</style>
<script src="http://www.axiomfiles.com/Files/258012/lockForum.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
 lockForum({

 
// Add more Forums separated by a pipe "|" (e.g. "Forum 1|Forum 2")
   NoNewTopicForum     : "Instructions",
   NoRepliesForum      : "General|Instructions"
,
  // The next variable is REQUIRED, do not change it at all
   accessLevel         : "$block[userlevelname]"
 });
})
</script>
Code (using all options)
<!--
**********************************************
 Locked Forums
********************************************** -->

<style type="text/css">
/* hide Add Topic Link */
#ctl00_ContentPlaceHolder1_ctl01_lnkAddTopic { display: none; }
/* hide Message tools (reply edit and delete links) */
.MessageToolsCell1 { display: none; }
</style>
<script src="http://www.axiomfiles.com/Files/258012/lockForum.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
 lockForum({
  // access levels that override the lock (use lower case)
   accessOverride      : "officer|super admin",
 
// Add more Forums separated by a pipe "|" (e.g. "Forum 1|Forum 2")
   NoNewTopicForum     : "Instructions",
   NoRepliesForum      : "General|Instructions",
 
// setting the next variables to true will completely remove the links
  // setting it to false will disable and fade out the links

   removeAddTopicLink  : false,
   removeReplyLinks    : false,
  // Options for links that aren't removed
   fadedOpacity        : 0.5,
   AddTopicLinkTooltip : "No New Topics Allowed in this Forum",
   RepliesTooltip      : "This Forum is Locked",
  // The next variable is REQUIRED, do not change it at all
   accessLevel         : "$block[userlevelname]"
 });
})
</script>

Customizing
  • The "accessOverride" variable sets the access level of the user that will override the locked forum script, it disables it. By default it is set to "super admin".

  • The "NoNewTopicForum" variable sets the forum title that you want to have the [ Add Topic ] link disabled.

    • This title can be a partial title but it is case sensitive. Make sure the portion of the title you use is unique.
    • Add additional forum titles by adding a pipe "|" character (shift-\, above the enter key) between the names.

  • The "NoRepliesForum" variable sets which forum will have all the topic reply, quote, edit and delete buttons disabled under every post.

    • This title can be a partial title but it is case sensitive. Make sure the portion of the title you use is unique.
    • Add additional forum titles by adding a pipe "|" character (shift-\, above the enter key) between the names.

  • The "removeAddTopicLink" is set to false by default. If you set it to true, the [ Add Topic ] link will be completely removed. Otherwise it will be faded out and disabled with a new tooltip showing as defined by the additional variables below.

  • The "removeReplyLinks" is set to false by default. If you set it to true, the reply, quote, edit and delete buttons will be completely removed. Otherwise these buttons will be faded out and disabled with a new tooltip as defined by the additional variables below.

  • The "fadedOpacity" variable is how much the disabled button is faded out. It is set to 0.5 (or 50%) by default.

  • The "AddTopicLinkTooltip" is the tooltip text that shows when you hover over the faded out and disabled [Add Topic] link.

  • The "RepliesTooltip" is the tooltip text that shows when you hover over any of the links under a post.

  • The "accessLevel" variable is required. What it does is send to the script the current user's access level. If removed the script will by default assume the user has public access.
Characters: Mottie Motty Mortie Ooshiny Mot Fudgems
TopBottom

 
 
Key 
New posts No new posts
New posts ( popular ) No new posts ( popular )
New posts ( sticky ) No new posts ( sticky )
New posts ( locked ) No new posts ( locked )
 
 
Who's Online 
There are   members online.
 
 
So-and-so has logged on!
%title%
%message%