Codex tools: Log in / create account
admin_init is triggered before any other hook when a user access the admin area. This hook doesn't provide any parameters and only callback a specified function.
Let's have a look at an example:
add_action('admin_init', 'restrict_admin', 1);
function restrict_admin(){
global $current_user;
get_currentuserinfo();
if ($current_user->user_level < 8) { //if not admin, die with message
wp_die( __('You are not allowed to access this part of the site') );
}
}
In this example we block access to the admin panel for user that are not in the admin group.