Post by iAlex on Dec 13, 2007 6:26:11 GMT -5
Alrighty, this code will allow you to force people to make a certain amount of posts before they can enter a board.
You just need to edit the red text at the top of the code.
Global Footer.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Minimum Posts to Enter Board - By iAlex - Open Source*/
var iBoardList=[
["Board ID", Required Posts],
["Board ID", Required Posts],
["Board ID", Required Posts] //No comma on last line
];
var iSafeUser=/^(admin|username1|username2)$/i; //Safe Usernames
if(location.href.match(/action=(display|viewprofile|(user)?recent|(calendar|pm)view|search2)/) && !pb_username.match(iSafeUser)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).className.match(/windowbg/) && iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/Posts:\s(.+?)<br\s?\/?>/i) && iTd.item(i).getElementsByTagName('b').item(0).firstChild.href.match('user='+pb_username+'$')){
var iCount=(iTd.item(i).innerHTML.match(/Posts:\s(.+?)<br\s?\/?>/i))? RegExp.$1 : '';
document.cookie='iPostCount='+iCount.replace(/,/g, '')+'iPostCountEnd;expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;';
break;
}
}
}
if(location.href.match(/board=/) && !pb_username.match(iSafeUser)){
var iCount=(document.cookie.match(/iPostCount=(.+?)iPostCountEnd/))? RegExp.$1 : 0;
for(var i=0;i<iBoardList.length;i++){
if(location.href.match('board='+iBoardList[0]+'$') && iCount<iBoardList[1] || location.href.match('board='+iBoardList[0]+'\&') && iCount<iBoardList[1] || location.href.match('board='+iBoardList[0]+'$') && pb_username=="Guest" || location.href.match('board='+iBoardList[0]+'\&') && pb_username=="Guest"){
document.title=document.title.replace(/ - (.+?)$/, ' - An Error Has Occurred');
document.getElementsByTagName('font').item(1).innerHTML=''+'171; An Error Has Occurred '+'187;';
var iTab=document.getElementsByTagName('table');
var a=iTab.length;
while(--a){
if(iTab.item(a).width=="92%" && iTab.item(a).cellPadding=="0" && iTab.item(a).cellSpacing=="0" && iTab.item(a).align=="center"){
iTab.item(a).style.display='none';
}
}
var iErMes=(pb_username!="Guest")? 'Sorry '+pb_displayname+' you are required to have '+iBoardList[1]+' posts to enter this board. You currently have '+iCount+' posts.<b'+'r /><b'+'r />If you believe that you have made the required amount of posts to enter, then please check your <a href="/index.cgi?action=viewprofile">profile</a> then try re-entering this board.' : 'Sorry Guest, but to access this board you are required to be logged in.';
document.write('<table width="92%" align="center" border="0" cellpadding="4" cellspacing="1" class="bordercolor"><tr><td class="titlebg"><font class="titletext" size="-1"><b>An Error Has Occured</b></font></td></tr><tr><td class="windowbg"><font size="2">'+iErMes+'</font></td></tr></table><b'+'r /><b'+'r />');
}
}
}
//-->
</script>
Ok, for editing instructions.
Board ID is the ID of the board that you want to have a post count restriction on. Now, make sure you use the actual ID, not the name. The ID of the board can be found in the URL, it will look something like this:
/index.cgi?board=here
Required Posts is just the amount of posts that needed to be made before someone can enter that board.
The safe users, are all those users who can enter the boards even if they don't have enough posts. You just need to enter their username sepearted with a: |
If you have any problems editing, or find any bugs, then don't hesitate to ask.
^^
You just need to edit the red text at the top of the code.
Global Footer.
Cross Browser.
Open Source.
<script type="text/javascript">
<!--
/*Minimum Posts to Enter Board - By iAlex - Open Source*/
var iBoardList=[
["Board ID", Required Posts],
["Board ID", Required Posts],
["Board ID", Required Posts] //No comma on last line
];
var iSafeUser=/^(admin|username1|username2)$/i; //Safe Usernames
if(location.href.match(/action=(display|viewprofile|(user)?recent|(calendar|pm)view|search2)/) && !pb_username.match(iSafeUser)){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).className.match(/windowbg/) && iTd.item(i).vAlign=="top" && iTd.item(i).innerHTML.match(/Posts:\s(.+?)<br\s?\/?>/i) && iTd.item(i).getElementsByTagName('b').item(0).firstChild.href.match('user='+pb_username+'$')){
var iCount=(iTd.item(i).innerHTML.match(/Posts:\s(.+?)<br\s?\/?>/i))? RegExp.$1 : '';
document.cookie='iPostCount='+iCount.replace(/,/g, '')+'iPostCountEnd;expires=Sat, 20 Jan 2050 12:12:12 UTC; path=/;';
break;
}
}
}
if(location.href.match(/board=/) && !pb_username.match(iSafeUser)){
var iCount=(document.cookie.match(/iPostCount=(.+?)iPostCountEnd/))? RegExp.$1 : 0;
for(var i=0;i<iBoardList.length;i++){
if(location.href.match('board='+iBoardList[0]+'$') && iCount<iBoardList[1] || location.href.match('board='+iBoardList[0]+'\&') && iCount<iBoardList[1] || location.href.match('board='+iBoardList[0]+'$') && pb_username=="Guest" || location.href.match('board='+iBoardList[0]+'\&') && pb_username=="Guest"){
document.title=document.title.replace(/ - (.+?)$/, ' - An Error Has Occurred');
document.getElementsByTagName('font').item(1).innerHTML=''+'171; An Error Has Occurred '+'187;';
var iTab=document.getElementsByTagName('table');
var a=iTab.length;
while(--a){
if(iTab.item(a).width=="92%" && iTab.item(a).cellPadding=="0" && iTab.item(a).cellSpacing=="0" && iTab.item(a).align=="center"){
iTab.item(a).style.display='none';
}
}
var iErMes=(pb_username!="Guest")? 'Sorry '+pb_displayname+' you are required to have '+iBoardList[1]+' posts to enter this board. You currently have '+iCount+' posts.<b'+'r /><b'+'r />If you believe that you have made the required amount of posts to enter, then please check your <a href="/index.cgi?action=viewprofile">profile</a> then try re-entering this board.' : 'Sorry Guest, but to access this board you are required to be logged in.';
document.write('<table width="92%" align="center" border="0" cellpadding="4" cellspacing="1" class="bordercolor"><tr><td class="titlebg"><font class="titletext" size="-1"><b>An Error Has Occured</b></font></td></tr><tr><td class="windowbg"><font size="2">'+iErMes+'</font></td></tr></table><b'+'r /><b'+'r />');
}
}
}
//-->
</script>
Ok, for editing instructions.
Board ID is the ID of the board that you want to have a post count restriction on. Now, make sure you use the actual ID, not the name. The ID of the board can be found in the URL, it will look something like this:
/index.cgi?board=here
Required Posts is just the amount of posts that needed to be made before someone can enter that board.
The safe users, are all those users who can enter the boards even if they don't have enough posts. You just need to enter their username sepearted with a: |
If you have any problems editing, or find any bugs, then don't hesitate to ask.
^^