inherit
2671
0
May 14, 2013 14:40:03 GMT -8
Peter
🐺
10,615
February 2002
peter3
|
Post by Peter on Sept 18, 2005 11:53:43 GMT -8
Was a code request which may be useful for others.
If you want to stop user A PMing user B, then you would add both usernames into the array (bit in bold), so when one of them goes to PMing the other, the form will be disabled.
<script type="text/javascript"> <!--
// Array of the members who cannot PM each other var iMembers = ["username", "username", "username", "username"];
function preventPM(){ var gotUser = false;
for(m = 0; m < iMembers.length; m ++){ if(iMembers[m] == document.cookie.match(/\buser=(\w+)/)[1]){ gotUser = true; break; } }
for(m = 0; m < iMembers.length; m ++){ if(iMembers[m] == document.postForm.to.value.replace(/\s/g, "") && gotUser){ for(e = 0; e < document.postForm.elements.length; e ++){ if(document.postForm.elements.item(e).name == "to"){ continue; } document.postForm.elements.item(e).disabled = true; } break; } else { for(e = 0; e < document.postForm.elements.length; e ++){ document.postForm.elements.item(e).disabled = false; } } } }
if(document.postForm && location.href.match(/=pmsend/i)){ document.onkeypress = preventPM; document.onkeyup = preventPM; window.onload = preventPM; }
//--> </script>
Main footer
|
|