rights.config

Позволяет добавлять собственные настройки прав доступа.

Доступно начиная с версии 5.1.9.

Shop-Script

Входящие параметры (передаются по ссылке)

$config object Экземпляр класса настроек прав доступа shopRightConfig.
… код плагина …

Результат работы плагина

Shop-Script

Пример кода плагина

PHP

public function rightsConfig(waRightConfig $config)
{
    // custom settings header
    $config->addItem($this->id . '_custom_header', _wp('My custom settings header'), 'header');

    // single checkbox setting
    $config->addItem($this->id . '_custom_checkbox_setting', _wp('Can do something'));

    // multi-checkbox setting
    $config->addItem($this->id . '_custom_checkbox_group_setting', _wp('Can do the following:'), 'list', [
        'items' => [
            'id1' => 'option 1',
            'id2' => 'option 2',
        ],
    ]);

    // complex setting allowing user to set up different access levels to several similar items (assets)
    $config->addItem($this->id . '_custom_list_setting', _wp('Can do anything of the following:'), 'selectlist', [
        'items' => [
            'value1' => _wp('asset 1'),
            'value2' => _wp('asset 2'),
            'value3' => _wp('asset 3'),
        ],
        'options' => [
            '0' => _wp('access level'),
            '1' => _wp('another access level'),
            '2' => _wp('one more access level'),
        ],
    ]);
}