SS
Asked
I need to make a couple of tweaks in views/sales/form.php based on if the current user is in the admin group. I'm sure that's a simple line of code, but I can't figure it out. Can you tell me what would work, please?
- SSAnsweredOkay, I found a solution.
In (themes/default/views) add.php and edit.php, I added the following at the top:
$is_admin = ($this->sim->in_group('admin'));
Then, in form.php, I can simply check for $is_admin where needed. - MSAnsweredI am glad that you have managed it. Thank you for updating
_There is a variable available in all the views as `$Admin` that will be same as of your `$is_admin`_ - SSAnsweredGood to know, about $Admin.
On the other hand, I have added another group that has "almost admin" so I still need to code my own in a few places. Others, however, might appreciate $Admin. - MSAnsweredHello,
You can add the lines in `__construct` method of `app/core/MY_Controller.php` same as for Admin.
`$Admin` is available to all the file in `themes` folder.
`$this->Admin` is available to all the file in `app` folder.
Thank you - SSAnsweredIt seems this isn't completely accurate.
$Admin is not set in default/views/header.php - Login to Reply