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.phpIt'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 ;) :)