Skip to content

Instantly share code, notes, and snippets.

@NateWr
Created May 7, 2019 13:53
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Block requests to change the publishingMode setting from anyone except the site admin.
<?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