Post by Don't Eat This on Dec 19, 2012 16:14:46 GMT -8
Okay, so I've been using a code in my role play forum for approving profiles (all credit goes to ross) in a particular board. What it did was, whatever thread was posted in that particular board, it would be pending- only admins could see it, regular members couldn't. To approve all we had to do was click on the approve thread link which would take us to editing/modifying the thread and we would hit submit. Then everyone would be able to see the thread. So if anybody can, can they make a v5 version of this?
<script type="text/javascript">
<!--
/*
pending threads with moderator approval - v0.5
coded by ross
http://support.proboards.com
please do not redistribute without permission
*/
// Icon Used to Identify threads awaiting approval
var icon = 'http://www.proboards.com/v4images/exclamation.gif';
// Types of Thread. ie. Application, Submission or just Thread
var name = 'Pending Profile';
// Message shown after posting a new thread.
var message = '<font size=2>Before users may view this profile, and before you can use this character anywhere in this forum, this profile must first be approved by a member of staff.</font>';
// The mode determines what the code is being used for. Use '1' to effect all new threads by all members except staff and the 'exception' members. Use '2' to put certain members on 'probation' where only their posts need approval
var mode = 1;
// Special users. Either ones that the code doesn't effect (mode 1) or the members on probation (mode 2)
var exceptions = '(admin|emberscore|lastingtwilight|shadeste)';
// No need to edit blow this line
var mod = false;
var a = document.getElementsByTagName('a');
for(i=0; i<a.length; i++) {
if(a.item(i).href.match(/(action=(admin|lockthread|stickythread)|&moderationmode)/))
mod = true;
else if(a.item(i).href.match(/action=modifypost/) && a.item(i).parentNode.parentNode.previousSibling.firstChild.firstChild.innerHTML.match(/^\[p\]:/)) {
a.item(i).href += '&accept';
a.item(i).innerHTML = '[Accept '+name+']';
a.item(i+1).style.display = (a.item(i+1).href.match(/doConfirm/))? 'none' : 'block';
a.item(i-1).style.display = (a.item(i-1).href.match(/quote=/))? 'none' : 'block';
} else if(a.item(i).innerHTML.match(/\[p\]:/) && a.item(i).href.match(/ion=(display|goto)/)){
if(mod && location.href.match(/board=\w+$/)) {
a.item(i).innerHTML = a.item(i).innerHTML.replace(/\[p\]:/, 'Pending Approval: ')
a.item(i).parentNode.parentNode.parentNode.previousSibling.firstChild.firstChild.src = icon;
} else if(!mod) {
if(location.href.match(/board=\w|d+$/)) {
a.item(i).parentNode.parentNode.parentNode.parentNode.style.display = 'none';
}
else if(location.href.match(/\.com\/?(index.cgi)?\??(action=home|#\w+)?$/) && !mod)
a.item(i).parentNode.innerHTML = a.item(i).parentNode.innerHTML.split(/by/i)[0];
else if(location.href.match(/ion=((user)?recent|search2)/))
a.item(i).parentNode.parentNode.parentNode.parentNode.parentNode.style.display = 'none';
else if(location.href.match(/ion=viewprofile/))
a.item(i).parentNode.parentNode.style.display = 'none';
}
}
}
if((pb_username.match(exceptions) && mode == 1) || (!pb_username.match(exceptions) && mode == 2))
mod = true;
if(document.postForm && !document.postForm.to && !document.postForm.subject.value.match(/Re:/i)) {
var pForm = document.postForm;
if(location.href.match(/&accept/)) {
pForm.subject.value = pForm.subject.value.replace(/\[p\]:/gi,'');
pForm.parentNode.rows[0].style.display = 'none';
var newCell = pForm.parentNode.insertRow(0).insertCell(0);
pForm.parentNode.className = 'bordercolor';
pForm.parentNode.cellSpacing = '1';
newCell.innerHTML = '<div style="text-align: center; margin: auto; padding: 10px;"><input type="button" value="Accept '+name+'" onclick="pForm.submit(true);"></div>';
newCell.className = 'windowbg2';
} else if(!pForm.to && !mod) {
pForm.subject.maxLength = 46;
pForm.onsubmit = function() {
if(pForm.nextaction.value == 'post') {
pForm.subject.value = '[p]:'+pForm.subject.value;
}
}
}
}
if(document.title.match(/ - :\w+/) && !mod) {
var table = document.getElementsByTagName('table')
message = '<table width=100% class=bordercolor cellspacing=1 cellpadding=4><tr><td class=titlebg><font size=2>An Error Has Occured</font></td></tr><tr><td class=windowbg>' +message+ '<br /><br /></td></tr></table>';
for(i=4; i<table.length; i++) {
if(table.item(i).width == '92%' && table.item(i).className == '' && table.item(i).innerHTML.match(/\[p\]:/)) {
table.item(i).rows[0].cells[0].innerHTML = table.item(i).rows[0].cells[0].innerHTML.split(/<table/i)[0] + message;
break;
}
}
}
//-->
</script>