2

I have 2 administrators in my wordpress, but I only want that one of them see the "Update Notification". I've inserted this code on my funtions.php file and change name of one of my adminastrator login name the code - if ($user_login !== "miguel") - but it didnt' work?

Any help? Thanks

2

this works fine for a specific user login:

 global $user_login;
   get_currentuserinfo();
   if ($user_login !== "admin") { // change admin to the username that gets the updates
    add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
    add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
   }

and this for a specific user id:

global $user_ID;
   get_currentuserinfo();
   if ($user_ID !== 1) { // change 1 to the id number that gets the updates
    add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
    add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
   }
  • Hi Bainternet, Thanks I tried also with the ID but still not working? I dont know if this is because I also installed on line of code to hide some wp menus? <?php add_action('admin_head', 'hide_menus'); function hide_menus() { global $current_user; get_currentuserinfo(); If($current_user->user_login != 'admin') { ?> <style> #menu-plugins{ display:none; } #menu-appearance{ display:none; } #menu-settings{ display:none; } #menu-links{ display:none; } #menu-users{ display:none; } #menu-tools{ display:none; } </style> <?php } }?> – Miguel Jun 2 '11 at 13:35
  • Glad i could help. – Bainternet Jun 2 '11 at 13:35
  • Do you think this is a problem? – Miguel Jun 2 '11 at 13:59
  • I've just tried with your code and it still works so that's not it. – Bainternet Jun 2 '11 at 14:25
  • 1
    I'm new to this... Do you think is the palce where I insert the code on funtions.php ( locate on:/wp-content/themes/mytheme/funtions.php)? – Miguel Jun 2 '11 at 14:30
1

this seems to work for me:

add_action('admin_head', function() {
    if(!current_user_can('manage_options')){
        remove_action( 'admin_notices', 'update_nag',      3  );
        remove_action( 'admin_notices', 'maintenance_nag', 10 );
    }
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.