Title: [Plugin: Hide Update Reminder] Nice plugin, but some code suggestions
Last modified: August 19, 2016

---

# [Plugin: Hide Update Reminder] Nice plugin, but some code suggestions

 *  [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/)
 * Nice plugin Sarah, but I wouldn’t recommend using user levels. Those have been
   deprecated since like WordPress 2.3.
 * I’d recommend this bit of code instead:
 *     ```
       add_action( 'admin_init', 'hide_update_reminder' );
   
       function hide_update_reminder() {
       	if ( !current_user_can('manage_options') )
       		remove_action( 'admin_notices', 'update_nag', 3 );
       }
       ```
   
 * That’s all that’s needed for your plugin. 🙂
 * (“`admin_init`” may be too early though for my code. If it is, use “`admin_head`“.)
 * [http://wordpress.org/extend/plugins/hide-update-reminder/](http://wordpress.org/extend/plugins/hide-update-reminder/)

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

 *  [Sarah Anderson](https://wordpress.org/support/users/sarahg111/)
 * (@sarahg111)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931879)
 * Cheers for the code, however I’m planning to set it so that users can control
   who sees or doesn’t see the update message. Some users may not want to see it(
   even as Admins) as they’re aware anyway, some may want Editors to see it but 
   not Author’s etc. However I’ll looking into the current_user_can() function and
   the remove_action hook is handy to know as I wasn’t aware of that, hence why 
   I just hid the div 🙂
 * Cheers
 *  Thread Starter [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931880)
 * > I’m planning to set it so that users can control who sees or doesn’t see the
   > update message. Some users may not want to see it (even as Admins) as they’re
   > aware anyway, some may want Editors to see it but not Author’s etc. However
   > I’ll looking into the current_user_can() function
 * [http://codex.wordpress.org/Roles_and_Capabilities](http://codex.wordpress.org/Roles_and_Capabilities)
 * I was mistaken. User levels have been deprecated since 2.0.
 *  [Sarah Anderson](https://wordpress.org/support/users/sarahg111/)
 * (@sarahg111)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931888)
 * Trouble is, user levels (ie. numbers) is the most logical method 🙂
 * I’ll be hunting through the Codex to see if there’s a way to simply say ‘User
   is Administrator’ or ‘User is Editor or above’ type method. This is why it’s 
   easier to say User level > X.
 *  Thread Starter [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931916)
 * > Trouble is, user levels (ie. numbers) is the most logical method 🙂
 * Not really, especially when it comes to custom roles. I for example could create
   a new role that had access to literally everything but the plugins page. The 
   role’s user level wouldn’t tell you that, but `current_user_can()` would. 😉
 * > I’ll be hunting through the Codex to see if there’s a way to simply say ‘User
   > is Administrator’ or ‘User is Editor or above’ type method.
 * I gave an example in my original post. 😉 Checking the “`manage_options`” capability
   is a good test as it’s safe to assume that if the user can’t access the various
   settings pages, then they aren’t an administrator.
 * An alternate (and arguably even better) capability to check could be `"activate_plugins"`
   which is the capability required to access the plugins activation menu.
 *  [Sarah Anderson](https://wordpress.org/support/users/sarahg111/)
 * (@sarahg111)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931918)
 * My point is, perhaps a user wants to set it so that they, as an Admin, can see
   the notice, their editors can see the notice, but their authors can’t. Or their
   author’s can, but standard subscribers can’t.
 * Using the current_user_can() function isn’t as efficient to differentiate between
   editors and authors. It’s fine until someone changes the user roles as you say,
   and that’s where the problem lies to find the right balance. It’s easy to spot
   an admin, but not so easy to determine other users. The only other option would
   be to allow the user to set who sees the message for all their users.
 * It’s just working out the most suitable solution 🙂
 *  Thread Starter [viper007bond](https://wordpress.org/support/users/viper007bond/)
 * (@viper007bond)
 * [17 years, 4 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931924)
 * > Using the current_user_can() function isn’t as efficient to differentiate between
   > editors and authors.
 * One of many possible solutions:
 * `current_user_can('unfiltered_html')`
 * Anyway, my point is merely just because it happens to work doesn’t necessarily
   mean it’s best practice. User level X doesn’t necessarily mean the ability to
   do Y, especially in the future.
 * It’s your plugin, do as you wish — I’m just giving my two cents and commenting
   on future proofing and such. 🙂
 *  [Sarah Anderson](https://wordpress.org/support/users/sarahg111/)
 * (@sarahg111)
 * [17 years, 3 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931935)
 * No I agree, future proofing is the best way and your code has helped (when I 
   get 5 minutes to update things!) 🙂

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

The topic ‘[Plugin: Hide Update Reminder] Nice plugin, but some code suggestions’
is closed to new replies.

 * 7 replies
 * 2 participants
 * Last reply from: [Sarah Anderson](https://wordpress.org/support/users/sarahg111/)
 * Last activity: [17 years, 3 months ago](https://wordpress.org/support/topic/plugin-hide-update-reminder-nice-plugin-but-some-code-suggestions/#post-931935)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
