Post by Todge on Mar 24, 2009 12:35:53 GMT -8
This will hide images posted by your members until a moderator has approved them..
Put it in your Global Footer..
Un-approved images will be replaced with a message for until they are approved..
Moderators with the ability to approve images will see the posted image but with a red border around it, to approve the image(s) simply modify the post.. The code will do everything for you, just click Modify, then modify the post without making any changes.
Edit this line at the top with a list of your moderator's USERNAMES you'd like to be able to approve the images..
Add as many as you like, just make sure you separate them with the | character.
Updated to remove the attachment feature
Put it in your Global Footer..
Un-approved images will be replaced with a message for until they are approved..
Moderators with the ability to approve images will see the posted image but with a red border around it, to approve the image(s) simply modify the post.. The code will do everything for you, just click Modify, then modify the post without making any changes.
<script type="text/javascript">
<!--
/*
Image approval code, by Todge
Copyright © 2009
Please keep this header intact
*/
//Edit below..
var mods = /^(admin|mod1|mod2|mod3)$/;
//Edit above..
// Set images to be approved..
if(document.postForm && pb_action != 'pmsend')
{
if(!pb_username.match(mods))
{
if(document.postForm.attachment)
{
document.postForm.attachment.parentNode.parentNode.style.display = 'none';
}
document.postForm.message.value = document.postForm.message.value.replace(/\.tba\.gif\[\/img\]/g,'[/img]');
function postImage()
{
document.postForm.message.value = document.postForm.message.value.replace(/\[\/img\]/ig,'.tba.gif[/img]');
return;
}
if(window.addEventListener)
{
document.postForm.addEventListener('submit', postImage, false);
}
else if(window.attachEvent)
{
document.postForm.attachEvent('onsubmit', postImage);
}
else
{
document.modifyForm.onsubmit = postImage();
}}
else
{
if(document.postForm.message.value.match(/\.tba\.gif\[\/img\]/))
{
alert("Click 'Modify' to approve the posted images.");
}
document.postForm.message.value = document.postForm.message.value.replace(/\.tba\.gif\[\/img\]/g,'[/img]');
}}
// Find un-approved images and remove or alter them..
if(location.href.match('action=display'))
{
var postedImages = document.images;
if(pb_username.match(mods))
{
for(p=0; p<postedImages.length; p++)
{
if(postedImages[p].src.match('.tba.gif'))
{
postedImages[p].src = postedImages[p].src.split('.tba.gif')[0];
postedImages[p].border = '4';
postedImages[p].style.borderColor = 'red';
postedImages[p].onmouseover = function(){
alert('Modify this post to approve this image.');
this.onmouseover = '';}
}}}
else
{
for(p=0; p<postedImages.length; p++)
{
if(postedImages[p].src.match('.tba.gif'))
{
var tba = document.createElement('FONT');
tba.innerHTML = '<b>IMAGE TO BE APPROVED</b>';
postedImages[p].parentNode.replaceChild(tba,postedImages[p]);
p--;
}}}}
// -->
</script>
Edit this line at the top with a list of your moderator's USERNAMES you'd like to be able to approve the images..
var mods = /^(admin|mod1|mod2|mod3)$/;
Add as many as you like, just make sure you separate them with the | character.
Updated to remove the attachment feature