Created
May 7, 2019 13:53
-
-
Save NateWr/2af249345fc4d31b673e43fc9338eb08 to your computer and use it in GitHub Desktop.
Block requests to change the publishingMode setting from anyone except the site admin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Refuse requests to change the publishingMode setting from anyone | |
* except the site admin. | |
*/ | |
HookRegistry::register('Context::validate', function($hookName, $args) { | |
$errors &= $args[0]; | |
$props &=$args[2]; | |
if (/* user is not an admin */) { | |
$errors['publishingMode'] = ['You can not modify this setting.']; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment