Support » Plugin: Post Lockdown » Lock posts for administrators too?

  • Hi there, this plugin seems to do exactly what I need! I’ve created a few wordpress pages that can be used as kind of ‘templates’: the site owner can copy and edit them, to create pages that look the same all the time. I want to protect these ‘template pages’ by locking them.

    However, the site owner has administrator rights; she wants to update WordPress, update plugins, and write & publish content.

    Would be great to lock pages for administrators too. Is that possible?

Viewing 3 replies - 1 through 3 (of 3 total)
  • BTW The pages that I want to protect are custom post types: articles for a knowledge base. I’m using MinervaKB as knowledge base plugin, and as far as I know, the custom post type is ‘kb’.

    Plugin Author andyexeter

    (@andyexeter)

    Hey Marc,

    The best solution I can think of would be to assign the user to a new role which has all capabilities of an administrator, then create a new capability for administrators only. Perhaps something like manage_options_and_kb_posts.

    Once the new role and capability are created you would then use the postlockdown_admin_capability filter to use the new capability rather than the default manage_options:

    
    add_filter('postlockdown_admin_capability', function() {
        return 'manage_options_and_kb_posts';
    });
    

    I have used the User Role Editor plugin for managing user roles and capabilities in the past and it seemed to work pretty well.

    Let me know how you get on!

    Hi Andy, thnx for the quick reply, mate!

    I’m not a coder, so your solution is just a bit too complicated for me. But no worries, I’ve posted my question in a Facebook group and I got this suggestion: https://pastebin.com/DUPCWBPa

    It seems to work quite nice, though it gives some warnings/messages about autosaved versions of the page. So I changed the code a bit.

    Instead of:
    remove_post_type_support( get_post_type( $post_id ), 'editor' );

    I’m using:
    echo "<script type='text/javascript'>alert('Dit is een template: niet wijzigen!');</script>";

    Now a popup appears telling the user that the page is a template and should not be edited. Not sure if it’s the best way to create a popup, but it works, and does not give the autosave message.

    Suggestions are appreciated, but for now it kind of works, so all fine 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Lock posts for administrators too?’ is closed to new replies.