We hope you enjoy your visit.

You're currently viewing our forum as a guest. This means you are limited to certain areas of the board and there are some features you can't use. If you join our community, you'll be able to access member-only sections, and use many member-only features such as customizing your profile, sending personal messages, and voting in polls. Registration is simple, fast, and completely free.


Join our community!


If you're already a member please log in to your account to access all of our features:

Username:   Password:
Add Reply
Auto-remove posts for certain groups; Easy administrating; By IceMetalPunk
Topic Started: Jan 23 2010, 12:45 AM (88 Views)
Reid
Member Avatar
È una trappola!

This topic has been moved from our official support board.

Originally posted by: IceMetalPunk
Auto-remove posts for certain groups; Easy administrating
 
Have you ever needed to move a member with many posts into a Banned group (or something similar)? Have you wished there was an easy way to remove their posts from view without going through them all manually?

Here it is!

Just stick this in the Board Wrappers->Footer:

Quote:
 
<script>
groups=new Array();

groups[groups.length]="Banned";

function arraySearch(arr,val) {
for (var j=0; j<arr.length; j++) {
if (arr[j] == val) {
return j;
}
}
return -1;
}

spans=document.getElementsByTagName("span");
trs=document.getElementsByTagName("tr");
for (p=0; p<spans.length; p++) {
pnode=spans[p].parentNode;
tab=pnode;
if (tab.tagName.toLowerCase()=="td") {
while (typeof tab!="undefined" && tab.tagName.toLowerCase()!="table") {
tab=tab.parentNode;
}
}
for (m=0; m<groups.length; m++) {
reg=new RegExp("Group: "+groups[m],"ig");

if (spans[p].className.toLowerCase()=="postdetails" && pnode.className.match(/post[0-9]/ig)!=null && pnode.tagName.toLowerCase()=="td" && pnode.vAlign.toLowerCase()=="top" && spans[p].innerHTML.match(reg)!=null) {
pnode.parentNode.style.display='none';
pos=arraySearch(trs,pnode.parentNode);
if (pos>0) { trs[pos-1].style.display='none'; trs[pos+1].style.display='none'; }
}
}
}
</script>


Copy/paste the bold line as many times as needed, one per group. Change the red to the name of the group. From then on, every post made by a member currently in one of the specified groups is removed automatically when any topic page loads.

Preview: http://z4.invisionfree.com/PHP_Store_2/index.php

It's a bit hard to see, but look at the "BLAH BLAH" topic in the TESTING forum with Javascript enabled. It looks like the only post there is IceMetalPunk's. But now disable Javascript and relolad the page, and you'll see that "temptemp" actually has the first post, but that account is banned, so his posts are removed.

Some things to keep in mind: The posts are not actually removed from the board, they are simply hidden from everyone's view. As such, there are a few side effects. Namely, the post count of your board will not decrease, and pages with posts that are removed may have a less-than-usual number of posts on it. Of course, going to the next page works fine, it's just that the posts are removed and no posts take their place.

Small side-effects for a code that can save so much time on busy/popular boards.

-IMP ;) :)
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Codes & Modifications · Next Topic »
Add Reply