R
R
Rus2018-10-16 14:42:24
1C-Bitrix
Rus, 2018-10-16 14:42:24

How to hide unnecessary Bitrix KP menu items?

Good afternoon, there is a left menu

spoiler
5bc5cd85b22f9619444833.png

I'm trying to hide some items for a certain group of users
How to properly customize the menu (without consequences)
Do I understand correctly that editing will be through .top.menu_ext.php ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2018-10-16
Madzhugin @Suntechnic

Correctly put in the last parameter the code whose call will return true if the item needs to be displayed. It is better if it is a function call. This is for static items.
For example !$USER->IsAuthorized() to show the menu item only to unauthorized users.
Those. so for example:

global $USER; 
$aMenuLinks = Array(
  Array(
    'Выход', 
    '/auth/?logout=yes', 
    Array(), 
    Array(), 
          '$USER->IsAuthorized()' 
  ),
        Array(
    'Вход', 
    '/auth/', 
    Array(), 
    Array(), 
          '!$USER->IsAuthorized()' 
  ),
);

Well, if the menu is formed dynamically, then you can also form the $aMenuLinks array in .top.menu_ext.php - you can do anything there. Just pay special attention to the cache.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question