• Hi.
    Can anyone tell me how to make some custom admin area plugin pages accesible only for one admin? (for example user with ID=1) ?

    Sorry for my english.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter avaterera

    (@avaterera)

    I’ve found one script witch may be usefull

    function check_user_capabilities() {
    global $user_level;
    
      if ((strpos($_SERVER['SCRIPT_NAME'], 'wp-admin/edit-comments.php')) or (strpos($_SERVER['SCRIPT_NAME'], 'wp-admin/comment.php'))) {
    
         if ($user_level < 9){
    	echo "<div class='wrap'><h2>Restricted area</h2></div>";
    	include('admin-footer.php');
    	die();
    
         }
      }
    }
    
    add_action('init', 'check_user_capabilities');

    Can it be modified to restrict access by user ID?

    Thread Starter avaterera

    (@avaterera)

    Please… i need it on my blog http://blog.brodowski.net.pl/

    You were close to the answer. Just change $user_level to $user_ID:

    global $user_ID;

    if ( $user_ID != 1 ){

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Acces only for one admin’ is closed to new replies.