prevent_homepage_deletion
Synopsis
This module adds a permission 'delete homepage node'. Users with this permission can delete or unpublish the node that is defined as frontpage in the system settings, if other permissions allow them to. Users without this permission cannot. The main goals is to prevent deletion or depublication, not to grant users the permission to do so. So if other permissions prevent them from deleting a node, granting them this permission will not change that.
In version 3 of the module also the 404 and 403 pages are protected if they are defined in the settings. And there is a custom setting that allows you to add specific other URL's that are protected the same way.
Users who cannot delete this page will not see the delete-button on the nodes, and also this option will not be available on the administer content view. The "Published" checkbox on the edit-form will also be hidden. When the bulk-action for deletion or depublication is used a message will be shown that this operation is not permitted.
Usage
- Install with composer composer require 'drupal/prevent_homepage_deletion:^3.0'
- Enable the module
- Find the new permission to delete the homepage
- Grand it to users with care
(if the user also has the 'bypass node access'-permission, that will overrule the working of this module)
- If you want to protect extra nodes, go to "Configuration" > "System" > "Prevent page deletion" and enter one path per line to protect it
Similar projects and how they are different
- Node keep Module provides a checkbox on page level to protect pages