Can be adjusted to prevent deletion but allow content edits?

Hi team. I'm scoping out this plugin and wonder if it can be used for what I'm trying to do...

1) Is this plugin the same feature that Blog Template has implemented? I think Blog Templates has a way to lock posts/pages.

2) Does this work on custom post types as well?

3) Is there a way to make Post Lock allow post/page content edits? I would like a page not to be deleted or anything else changed on it by admins except for the content.

Here's more about what I'm trying to do:
I'll have some pages that are more like system pages, they need to be there and admin should be able to change SOME of the content.

The first example that comes to mind are custom welcome and exit pages. I have a login and logout redirect plugin that points to custom pages I've created called Welcome.php and Exit.php. User logs in and is taken to a custom welcome page, logs out and gets an exit page.

I created custom templates for both these pages so that some content never changes. The exit page might have future events hard coded into the template so the user can't mess with this. But the admin should be able to go to those pages and fill out the page content which will be their own personalized message and will display on these pages.

About these pages:

* These system pages have both hard coded content and space available for personalized message.

* If admin doesn't fill out a personalized message there's no problem, other content will show.

* These pages are required and should never be deleted.

  • Adam Czajczyk

    Hello Robert,

    I hope you're doing well today!

    1) Is this plugin the same feature that Blog Template has implemented? I think Blog Templates has a way to lock posts/pages.

    The feature is a bit similar but in case of New Blog Templates it works only for content that's been "carried over" from template to the site and is applied only with creation of the new site. You cannot select "any post" from "any subsite" and lock it down. That is where "Lock Posts" comes to play.

    2) Does this work on custom post types as well?

    It supports custom posts.

    3) Is there a way to make Post Lock allow post/page content edits? I would like a page not to be deleted or anything else changed on it by admins except for the content.

    The plugin can only let you lock/unlock post entirely and such lock can only be changed/unlocked by super-admins. There's no option to block post from deletion only but leave it open for editing.

    Here's more about what I'm trying to do:
    I'll have some pages that are more like system pages, they need to be there and admin should be able to change SOME of the content...

    I think there may be a bit different way to achieve that. Since you have already created custom page templates for these page that have some content hardcoded and only want to let sub-sites admins' edit selected parts of it, you could go for a bit more of a custom coding. Here's what I'm thinking:

    Instead of making pages "partially editable" create a simple plugin that would include some text fields. Text fields of course can use WP editor or not but that's up to you. Values of these fields could be stored e.g. as meta data ("meta_key", "meta_value", WP provides mechanisms for that) so for example for "welcome page" there'd be "admin_page_welcome" meta key and for "exit page" there'd be "admin_page_exit" meta key and so on.

    Then it would be easy to include capability check in such plugin so only admins and super admins could access it and then you could fetch values of these fields directly in the template. That'd require a bit of custom coding but doesn't seem very complex and although a bit "weird" as it may seem it may turn out to be quite a robust solution.

    If you have additional questions, let me know please.

    Best regards,
    Adam

  • Adam Czajczyk

    Hello Robert!

    It'd be a simpler solution, indeed. I think the code should work but please remember about this line:

    if( $post_id == ID ) {

    You will need to replace ID with a number representing an ID of post/page. In this form it supports only a single page/post so if there's more of them that you'd like to protect you can use it like this:

    if( ($post_id == ID) II ($post_id == ID) ) {

    where IDs are for different posts/pages. If there's a lot of pages you may also try this instead above line

    $my_protected_posts = array( '1', '5', '25', '4023' );
    if (in_array($post_id, $my_protected_posts)) {

    where numbers in first line represent posts/pages IDs.

    Best regards,
    Adam

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.