Hello. Please tell me what could be the problem. The code should be used to verify that the user belongs to a particular group. It works out correctly, but the re-election of the “Chairman” / “Presiding”, the check does not occur. Those. I need to ban all groups except for certain ones (set in a separate request) - choose "coffee break" and "drinking water". If I select at the very beginning of the user, the script will work, but if I re-select the user, then the user’s checking for group membership does not happen again, but the old group remains. Unfortunately, I am not a developer or even a junior, because I have a problem with understanding this bug. The source code is attached.

https://cloud.mail.ru/public/KocM/jRnCCMU72

I tried to refine the replay of the ajax request, but unfortunately the script did not re-work again. In fact, there are two solutions:

  1. At each choice (or during critical switching, for example, the "participant" was selected, and the choice switches to "organizer", which has more access) to reload the page. === A fairly simple option from the development point of view, but many page reloads (the user's attention gets lost, they need to wait longer);

  2. With each selection, an AJAX request is launched that rechecks accesses and redraws changed parts of the page. For example, there was only a coffee break option available, and another “meeting with a star” or “selfie with a lecturer” was added. === More difficult to implement, but ... so, in theory, everything should work.

Unfortunately, neither the first nor the second option was implemented.

    2 answers 2

    Since everything is in template.php and the code is processed once, and then not, all the information is likely to be cached from you. For the test, turn off the cache and see if it will work. If yes, then you need to bring additional logic out of the cached area, well, or turn off the cache for a specific component (everything here depends on the strength of the project and this page as a whole)

    • I'm afraid not in the cache problem. I tried to ban the cache on the page, unfortunately it did not give an effect. Although I do not exclude the possibility that I did wrong and the cache continued to be filled. - Dmitry Goncharov
    • globally in the settings for a while, turn off the cache and try to check, or if it is a test environment, you can clean the /bitrix/cache/ folder for confidence and check) - maxkrasnov

    The error was not in the cache, it was in the wrong values ​​returned after the definition of the department. Converted a return from 3 to 1, began to work out. After corrected display checkboxes when checking.