moodle-an-hochschulen / moodle-theme_boost_union

Theme Boost Union is an enhanced child theme of Boost which is intended, on the one hand, to make Boost simply more configurable and, on the other hand, to provide helpful additional features for the daily Moodle operation of admins, teachers and students.
GNU General Public License v3.0
67 stars 58 forks source link

Boost Union - Smart Menus - "Restrict visibility by language" is not applied correctly sometimes #697

Open acquaalta opened 3 months ago

acquaalta commented 3 months ago

Hi,

Moodle version: 4.3.5 Plugin version: v4.3-r13 (2023102038)

We have a couple of smart menus that their visibility is restricted by language. Since the UI is in one specific language at any given time, only one of these smart menus should be displayed. The issue is that sometimes, and I don't understand why and when exactly, we get to see two smart menus at the same time. It's is unwanted, of course, and a duplication of a menu since the content in both menus is the same.

Did you encounter such an issue?

anna-sparkfore commented 3 months ago

We have also this problem and we run Moodle ver 4.3.2 and plugin ver v4.3-r13. I have tested with the language restriction on the top level and sometimes got the menu item in several languages. I have not been able to identify why this happens either, unfortunately. It's not happening in the same session though. I have seen the error when I logged in anew maybe 1 h later.

acquaalta commented 2 months ago

Hi @anna-sparkfore It's "good" to know that we didn't "imagine" this bug. I hope that it will be solved at some point. Thanks for your comment :-)

wiebkemueller-hsh commented 2 months ago

Hi @acquaalta and @anna-sparkfore

could you provide some more information on this? We've had this same mistake in previous Moodle and theme versions (now on Moodle 4.4.2, Boost Union v4.4-r1) but as you said were never able to reproduce it reliably. For now I remember the following details on the problem, could you provide steps to reproduce or check if this fits with your settings so we can hopefully nail this down to a particular combination?

Menu mode: inline Presentation type: list Menu item type: static

  1. Login as admin

  2. create new smart menu under /theme/boost_union/smartmenus/menus.php with the following setting Menu mode: inline Presentation type: list restrict visibility by language (e.g. German) Menu item type: static (in our case we linked to a particular course in the system restrict visibility by language (e.g. German) for menu item

  3. duplicate the whole thing

  4. change restrict visibility by language (to English) in the duplicate for the menu and for the item

What happened was that the original menu would appear twice for mainly admins and users logged in as managers, probably after having changed the systems language a few times to test, varying with browsers.

Does this procedure ring a bell with you? Please add more or altering steps if possible, thank you!

Imiladris commented 2 months ago

This happens, after visiting courses with forced language. i.e. My prefered system language is russian, I see Russian language. If i visit a course with forced English, both RU and En menues display

acquaalta commented 2 months ago

Hi @wiebkemueller-hsh, We experience the bug with different settings: Menu mode: Submenu Presentation type: List Menu location: Main Navigation Menu item type: Dynamic courses Access rules: By language

anna-sparkfore commented 1 month ago

Here's a fresh example: I log in and the interface is in Swedish but there are 2 menu items showing: image

I visit the Preferred language page to verify that my selected language is Swedish: image

In Smart menues I have 2 items: Admin shortcuts in Swedish and English. Menu location(s): Main navigation Menu mode: Submenu Presentation type: List Restrict visibility by roles: Manager Restrict visibility by language: Swedish - English (one per each) image

The menu items are static and have no additional restrictions: image

I then used the Language selector to switch language to English (which is a temporary language switch). Then the interface reloads and only the Smart menu in English is shown, now the Swedish menu is hidden. image image

I then logged out, and logged in again. Now only the Smart menu in Swedish appears. image

Is there an issue with having 2 restrictions (user role = manager + language = English/Swedish) on a Smart menu? How would you recommend the setup for that scenario?

anna-sparkfore commented 1 month ago

Also, I just realized a detail that might be related. We use a child language pack "sv_wp" instead of sv AND we have a customized language menu to avoid having 2 Swedish options in the language selector: image

wiebkemueller-hsh commented 1 month ago

Thank you for the detailed examples and documentation on this, we will try to figure something out.

Marvin-Kirch commented 1 month ago

Hello everyone, We have encountered exactly the same problem. We have noticed that the problem always occurs when you log out and are only logged in as a guest. If you visit the course page and change the language, both smart menus are displayed. If you then log in again as admin, you have the same problem. Otherwise the problem seems to occur almost randomly.

we tested the plugin versions v4.3-r13 (2023102038) and v4.3-r15 (2023102042)