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