Question: Custom Group Permissions

Custom Group Permissions

Hi, I tried to set/create some custom group permissions for some Sale options. It's for **Add Sale** page and then the **Sale Status** option. I already did the following: 1. added the f

VK

van Kessel

Asked
Hi,

I tried to set/create some custom group permissions for some Sale options.
It's for **Add Sale** page and then the **Sale Status** option.

I already did the following:

1. added the following code to the add.php (in themes - admin - views - sales)

```php
<?php if ($Owner || $Admin || $GP['test-status']) {
?>
<div class="col-sm-4">
<div class="form-group">
<?= lang('sale_status', 'slsale_status'); ?>
<?php $sst = ['order_created' => lang('order_created'), 'order_shipped' => lang('order_shipped'), 'order_delivered' => lang('order_delivered')];
echo form_dropdown('sale_status', $sst, '', 'class="form-control input-tip" required="required" id="slsale_status"'); ?>

</div>
</div>
<?php
} ?>
```

2. Created an extra checkbox option in permissions.php (in themes - admin - views - settings)
```php
<span style="display:inline-block;">
<input type="checkbox" value="1" id="test_status" class="checkbox" name="test_status" <?php echo $p->{'test_status'} ? 'checked' : ''; ?>><label for="test_status" class="padding05"><?= lang('test_status') ?></label>
</span>
```
3. Created an extra rule in the permissions section in system_settings.php (in app - controllers - admin)
```php
'test-status' => $this->input->post('test-status'),
```

But unfortunately the custom permission still doesn't work. I can check the option, but it is not implemented/saved after saving.
What and where have I forgotten something? I think I'm missing something where I have to make the extra settings.

Can you help me with this?

Thanks!
  • MS

    Mian Saleem

    Answered
    Hello,

    I notice that you used `test_status` as name but try to get post value of `test-status` :( Please check that and make sure that you have update the permissions table with new field.

    Thank yo
  • VK

    van Kessel

    Answered
    Hi,

    Thanks for the quick response!
    I made a mistake with "test_status" and "test-status" :sweat:
    I had indeed created a new field in the permissions table.

    So the custom rights now work properly :smiley:
    Thanks again!
  • Login to Reply