Post by Tylr on May 10, 2011 14:35:18 GMT -8
This code works by getting the number of posts you have from your miniprofile and storing them in a cookie, therefore it will not be completely accurate. For instance, if you switch computers, restart, clear your cache or anything else that could tamper with the cookies you may need to view your mini profile again. This is as simple as viewing any post made by you, or your profile.
That being said, modify the red for how many posts you'd like to require a user to have before they are allowed to create a thread. Modify the blue for whether the new thread links should be displayed by default, or not. If set to yes, users who are new to the forum and have not viewed their miniprofile recently (or at all) may be allowed to create threads. If set to no, long-time users who are on a computer at a library or deleted their cookies won't be able to create a new thread until they've viewed their own miniprofile.
<script type="text/javascript">
<!--
// Only allow thread creation with X posts - by Tylr
// Original: support.proboards.com
var numposts=20 // Number of posts required to post new threads
var defaultshow="no"; // Should I allow new threads if I don't know how many posts a user has?
function hideTpost(){
var ah=document.getElementsByTagName('a')
for(i=0;i<ah.length;i++){
if((ah.href.match('action=post') || ah.href.match('action=createpoll')) && !ah.href.match('thread=')){
ah.style.display='none';
}
}
}
if(document.cookie.match('posts=')){
if(document.cookie.split('posts=')[1].split(';')[0]<numposts){
hideTpost();
}
} else {
if(defaultshow=="no") {
hideTpost();
}
}
if(location.href.match('action=viewprofile') || location.href.match('thread=')){
var ahh=document.getElementsByTagName('a')
for(q=0;q<ahh.length;q++){
if(ahh[q].href.match('viewprofile&user='+pb_username)){
document.cookie='posts='+ahh[q].parentNode.parentNode.innerHTML.split('Posts: ')[1].split(/</)[0];
break;
}
}
}
// -->
</script>
That being said, modify the red for how many posts you'd like to require a user to have before they are allowed to create a thread. Modify the blue for whether the new thread links should be displayed by default, or not. If set to yes, users who are new to the forum and have not viewed their miniprofile recently (or at all) may be allowed to create threads. If set to no, long-time users who are on a computer at a library or deleted their cookies won't be able to create a new thread until they've viewed their own miniprofile.
<script type="text/javascript">
<!--
// Only allow thread creation with X posts - by Tylr
// Original: support.proboards.com
var numposts=20 // Number of posts required to post new threads
var defaultshow="no"; // Should I allow new threads if I don't know how many posts a user has?
function hideTpost(){
var ah=document.getElementsByTagName('a')
for(i=0;i<ah.length;i++){
if((ah.href.match('action=post') || ah.href.match('action=createpoll')) && !ah.href.match('thread=')){
ah.style.display='none';
}
}
}
if(document.cookie.match('posts=')){
if(document.cookie.split('posts=')[1].split(';')[0]<numposts){
hideTpost();
}
} else {
if(defaultshow=="no") {
hideTpost();
}
}
if(location.href.match('action=viewprofile') || location.href.match('thread=')){
var ahh=document.getElementsByTagName('a')
for(q=0;q<ahh.length;q++){
if(ahh[q].href.match('viewprofile&user='+pb_username)){
document.cookie='posts='+ahh[q].parentNode.parentNode.innerHTML.split('Posts: ')[1].split(/</)[0];
break;
}
}
}
// -->
</script>