Hello,
i am using version 2.5 of PW and trying to hide settings tab on user role webmaster (which is my defied role)
i have use bellow code
<?php
class AdminHelperHooks extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'My Admin Helper Hooks',
'version' => 1,
'singular' => true,
'autoload' => true
);
}
public function init() {
// add hook to the page edit module and the method that creates the wanted fieldset
$this->addHookAfter('ProcessPageEdit::buildFormRoles', $this, "removeSettings");
}
function removeSettings(HookEvent $event){
// check what role the user has, if not has editor role do nothing
if(!wire("user")->hasRole("webmaster")) return;
// $event->return being the inputfield wrapper
$wrapper = $event->return;
// set the inputfield wrapper to hidden
$wrapper->collapsed = Inputfield::collapsedHidden;
// we're done
}
}
in site/modules/AdminHelperHooks/AdminHelperHooks.module
also i install the module but when i login as user using webmaster group i can see settings tab. how i hide page setting tab for this type of user ?
Thanks