Homepage
Main navigation
Main content
Additional information
October Tricks
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
October CMS resources and help articles
Simple and to the point. Optimized by the community.
×
Login / Sign up
Quality Guidelines
About
GitHub
Propose new content
Edit trick
Changes will be published after manual review
Title
Give your trick a describing title. Do
not
start with «How to...».
Your trick
Keep it short and concise! Markdown is supported.
Disabling user group UI items is a great way of decluttering your backend for projects that don't use the features. Firstly, this code is required in your plugin's Plugin.php: ``` use Backend\Controllers\Users as BackendUserController; // ... public function boot() { BackendUserController::extend(function ($controller) { $controller->listConfig = $controller->makeConfig($controller->listConfig); $controller->listConfig->toolbar = array_merge($controller->listConfig->toolbar, ['buttons' => '$/acme/blog/partials/toolbar.users.htm']); }); BackendUserController::extendListColumns(function ($list, $model) { $list->removeColumn('groups'); }); BackendUserController::extendFormFields(function($form, $model, $context) { $form->removeField('groups'); }); } ``` Make sure to replace `acme/blog` with the name of your plugin. Finally, create the file `partials/toolbar.users.htm` in your plugin's root directory, with the following code: ``` <div data-control="toolbar"> <a href="<?= Backend::url('backend/users/create') ?>" class="btn btn-primary oc-icon-plus"> <?= e(trans('backend::lang.user.new')) ?> </a> <?php if ($this->user->isSuperUser()): ?> <a href="<?= Backend::url('backend/userroles') ?>" class="btn btn-default oc-icon-address-card"> <?= e(trans('backend::lang.user.role.list_title')) ?> </a> <?php endif ?> </div> ```
References
Add additional online resources to your trick
×
Name
URL
+ Add reference
Topics
If your trick fits more than one topic select multiple. Select at least one.
Backend
Plugin Development
CMS
Twig
Themes
Deployment
Tags
You can use existing tags or create new ones. Add at least one.
Submit for review
Cancel
We use cookies to measure the performance of this website. Do you want to accept these cookies?
Accept
Decline