vForums Support > Programming & Coding :: Database of Codes/Hacks/Mods :: > Stop Deleting First Post

Stop Deleting First Post - Posted By Michael (wrighty) on 11th Apr 08 at 2:16pm
This code will make it so that the person that made the first post in a topic is unable to delete their post. It allows the option to make it so that staff can delete the post or not.

Change the part in red to either true or false. This will alter whether staff can delete the post or not.

<script>

var s = false; //Allow staff to delete the post?

if(get('reply-0','id')){
    var a = get('reply-0','id');
    var u = a.parentNode.previousSibling;
    if(u.getElementsByTagName('a')[0].href.match(/view_profile\/user\/(.+?)(\/$|$)/) && RegExp.$1 == vf_username){
        if(s){
            if(!get('menu_buttons','id').innerHTML.match(/action\/admin/)){
                a.getElementsByTagName('a')[2].style.display = 'none';
            }
        }else{
            a.getElementsByTagName('a')[2].style.display = 'none';
        }
    }
}
</script>


Global Footer