Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to block any admin of a Wordpress install from being able to modify certain pages, the sort of stuff detailed here: http://wackao.com/be-a-wordpress-super-administrator/ . Is this even possible? Thank you.

I would like to do this by modifying the core word press files.

share|improve this question
3  
Downvote for "I would like to do this by modifying the core word press files." Unless you intend to maintain a forked application, modifying core files is strongly discouraged. –  Chip Bennett Apr 9 '12 at 18:12
    
Seconded - WordPress is designed so you should never need to modify core files. –  SickHippie Apr 9 '12 at 19:32
add comment

migrated from stackoverflow.com Apr 9 '12 at 17:49

This question came from our site for professional and enthusiast programmers.

2 Answers

up vote 5 down vote accepted

I would recommend creating a Custom User Role, using the add_role() function, such as a "Site Admin" or "Sub-Admin" (or whatever you want to call it). Then, you can assign specific user capabilities to that custom role, thereby giving users exactly the capabilities you want them to have, without giving them the capabilities you don't want them to have.

For example:

<?php
add_role( 
    // Role slug
    'sub-admin', 
    // Role display name
    'Sub-Admin', 
    // Capabilities
    array(
        activate_plugins,
        add_users,
        create_users,
        delete_others_posts,
        delete_pages,
        delete_plugins,
        delete_posts,
        delete_private_pages,
        delete_private_posts,
        delete_published_pages,
        delete_published_posts,
        delete_users,
        edit_dashboard,
        edit_files,
        edit_others_posts,
        edit_pages,
        edit_posts,
        edit_private_pages,
        edit_private_posts,
        edit_published_pages,
        edit_published_posts,
        edit_theme_options,
        export,
        import,
        list_users,
        manage_categories,
        manage_links,
        manage_options,
        moderate_comments,
        publish_pages,
        publish_posts,
        read_private_pages,
        read_private_posts,
        read,
        remove_users,
        switch_themes,
        unfiltered_upload,
        upload_files
    ) 
);
?>

(Those are the default "administrator" capabilities, with caps related to editing others' pages, and promoting users, removed.)

Available Plugins

There are several Plugins available that provide a UI for creating and modifying user roles, including:

share|improve this answer
2  
In addition to the plugins Chip pointed out, check out User Role Editor - this is the plugin I currently use for role management, and it's done very well for me. –  SickHippie Apr 9 '12 at 19:35
add comment

Yes, anything is possible with the use of the internet combined with precise and thought-out questions. Here's a plug-in that might help: http://urbangiraffe.com/plugins/user-permissions/

share|improve this answer
    
Ok, but if the admin can disable it, it's basically no good, that's why I was thinking of modifying WP core files –  Andrew Apr 5 '12 at 19:15
    
And that is why you should modify your question :) –  RyanS Apr 5 '12 at 19:26
    
ok, thank you :) –  Andrew Apr 5 '12 at 19:34
    
Maybe consider granter more permission to a lower level, instead of taking the admin down a notch. –  RyanS Apr 6 '12 at 16:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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