Correct me if I'm wrong but in your code...if $logip==2 then only your mods can view the IP...when $logip==2 sets the "view IP's to public viewing".
No big deal just a thought.
Thanks wluke for optimizing my code for me and teaching me about that ismoderator function. Very useful.
Now I'm off to go optimize some other code of mine where the usergroupid lines may range forever onward.