Guest User

Untitled

a guest
May 20th, 2010
349
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //define admin menu function
  2.  
  3. function admin_menu_restriction() {
  4.     global $current_user;
  5.     if (current_user_can('manage_options')) { }
  6.     else{
  7.         $pageURL = 'http';
  8.        
  9.         //https restriction
  10.        
  11.         if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
  12.             $pageURL .= "://";
  13.         if ($_SERVER["SERVER_PORT"] != "80"):
  14.             $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
  15.         else:
  16.             $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
  17.         endif;
  18.    
  19.         // redirect to 404 Page
  20.         {
  21.             header("Location:".get_bloginfo('url')."/404.php");
  22.         }
  23.     }
  24. }
  25.  
  26. add_action('admin_init', 'admin_menu_restriction');
RAW Paste Data