rights.config
Позволяет добавлять собственные элементы настройки прав доступа к приложению.
Доступно начиная с версии 1.0.0.
Блог
Входящие параметры (передаются по ссылке)
$params waRightConfig Экземпляр класса настроек прав доступа.
… код плагина …
Результат работы плагина
Блог
Пример кода плагина
PHP
public function rightsConfig(waRightConfig $config)
{
//custom settings header
$config->addItem('myplugin_custom_header', _wp('My custom settings header'), 'header');
//single checkbox setting
$config->addItem('myplugin_custom_checkbox_setting', _wp('Can do something'));
//multi-checkbox setting
$config->addItem('myplugin_custom_checkbox_group_setting', _wp('Can do the following:'), 'list', array(
'items' => array(
'id1' => 'option 1',
'id2' => 'option 2',
),
));
//complex setting allowing user to set up different access levels to several similar items (assets)
$config->addItem('myplugin_custom_list_setting', _wp('Can do anything of the following:'), 'selectlist', array(
'items' => array(
'value1' => _wp('asset 1'),
'value2' => _wp('asset 2'),
'value3' => _wp('asset 3'),
),
'options' => array(
'0' => _wp('access level'),
'1' => _wp('another access level'),
'2' => _wp('one more access level'),
),
));
}









