[wp-hackers] Partial admin capabilities

Andrew Nacin wp at andrewnacin.com
Tue Jul 27 22:12:14 UTC 2010

On Tue, Jul 27, 2010 at 6:02 PM, Ryan Bilesky <rbilesky at gmail.com> wrote:

> I want to write a plugin where everytime something that requires the
> capability install_plugins (for example) is required it also adds the
> condition that the current user's userid is 1.  The purpose of this would
> be
> to restrict certain actions to just me, even though I have other
> "administrators" on the blog, I want them to have some of the admin
> capabilities but not all,

It would probably be easier to just leverage the map_meta_cap filter. And
tack on the 'do_not_allow' capability whenever the user isn't you, and it's
a capability you don't want others to have. Check out how map_meta_cap()
works toward the bottom -- core does this exact thing.

More information about the wp-hackers mailing list