Welcome Guest [Log In] [Register]
Search Members Calendar | Rules ZB Code Index IF Code Index
ZBCode
  • Navigation
  • ZBCode
  • Coding Resources
  • Code Requests
  • Completed Requests
  • [Completed] [ZB] No edits in a pre-defined forum
Hey, welcome to ZBCode, the premier coding forum for ZB. Here you fill find some of the best Invisionfree and Zetaboards Codes on the network! Unfortunately, you're sorta hovering around in guest mode at the moment; why not join in on the fun? Register an account and you can start accessing the wealth of resources we have available here. Enjoy your stay at ZBCode, and remember to tell all your friends about us; the more members, the more codes available. ;)

Interested in joining? Click here.


If you are already a member of ZBCode, feel free to login right here:

Username:   Password:
Locked Topic
[Completed] [ZB] No edits in a pre-defined forum
Tweet Topic Started: Nov 25 2009, 06:12 PM (227 Views)
Lout Nov 25 2009, 06:12 PM Post #1
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
Simple one this (I think), I want to disable post editing in a pre-determined forum of thread.

As long as I can edit the code using either the forum or thread ID then that is fine.

Obviously, I understand that this can be bypassed by disabling JS, but that isn't a problem in this case.
Posted Image
Offline Profile Goto Top
 
Choco Nov 25 2009, 06:49 PM Post #2
Member Avatar
¡ʎɹoʇɔɐɟ ʎʇıʌɐɹƃ ɐ uı pǝddɐɹʇ ɯ,ı 'dןǝɥ

Posts:
589
Group:
Admins
Member
#3,272
Joined:
Jun 30, 2009
Coding language
Everything
Okay, try this one out. Keep in mind it's been a while since I've coded! :D
Code:
 

<script type="text/javascript">
/*-----------------*\
Disable Editing
in Forums and Topics
By Choco of ZBCode.com
*\-----------------*/
noEditTopics = [ "257833" , "521" ];
noEditForums = [ "256996" , "546" ];

$(function() {
window.location.href.match(/\/topic\/(\d+)\//i);
disable = false,topic=RegExp.$1,hrefs=[];
$("#nav li a").each(function() {hrefs[hrefs.length] = $(this).attr("href");});
hrefs=$.map(hrefs,function(n) {return n.match(/\/forum\/(\d+)\//i)?RegExp.$1:null;});
for(i=0;i<noEditTopics.length;i++)
disable = noEditTopics[i] == topic ? true : false;
for(i=0;i<hrefs.length;i++)
disable = $.inArray(hrefs[i],noEditForums) > -1 ? true : false;
if(disable) $("a[href*=mode=3&type=1]").remove();
});
</script>


I've made it so you can disable editing in multiple topics and multiple forums. Also, if you ban Forum A, and forum B is a subforum in A, editing will be disabled in Forum B as well. Is that okay? I can change it if you like. :)

Here's how to edit it:
Find this:
Code:
 

noEditTopics = [ "blah" , "blah" ];

And the corresponding noEditForums. Simply fill out comma separated quoted topic numbers / forum numbers in their corresponding spots for each forum or topic you want editing banned in. In these forums/topics, the edit button will be removed.

I hope that works for you, please let me know if it doesn't.

Enjoy,
Choco
Edited by Choco, Nov 25 2009, 06:51 PM.
Posted ImageIt's a magical world, Hobbes, ol'd buddy... ...let's go exploring!
In progress: Something Special ;)
Offline Profile Goto Top
 
Lout Nov 26 2009, 06:34 AM Post #3
Member Avatar


Posts:
402
Group:
Dedicated
Member
#2,400
Joined:
Feb 19, 2009
Doesn't work I'm afraid Choco, but Reid knocked one up that disables it in a forum for me so this can be closed if need be.
Posted Image
Offline Profile Goto Top
 
Vitality Nov 26 2009, 07:25 AM Post #4
Member Avatar
Tabula Rasa

Posts:
784
Group:
Former Staff
Member
#320
Joined:
Jul 26, 2008
You're welcome.
See? We can read thoughts too. ;)

Your request has been completed, and we're moving it to the correct forum. We hope it works for you; if it doesn't, feel free to post another request topic in the requests forum. Just remember: read the rules first!

Thanks,
The ZBCode Staff
Offline Profile Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Completed Requests · Next Topic »
Locked Topic

Track Topic · E-mail Topic Time: 2:26 PM Jul 11
Hosted for free by ZetaBoards · Privacy Policy