Add "Switch role to..." in the User Menu

Issue #586 resolved
Info 3bits created an issue

Switch role has been moved in moodle 3.2 from Administration menu to User menu.

Add this item in the user menu.

Comments (22)

  1. Gisele Brugger

    Hello Fernando, This functionality is essential for the teacher profile. He will have greater security to be sure of how the course is being viewed for the student.

  2. Jeremy Hopkins

    I took a look at this earlier, building the url to switch role is easy enough but the "return to my normal role" also has to be added so its a bit of a pain.

    I think this needs to be added before version 2 as that is some months away and this is quite fundamental functionality.

  3. Michael Douglas

    I have a modified version of Adaptable theme that implements the default Moodle menu to the theme. However I had to make some changes in the corerenderer.php file in order to make this work. If you guys are interested in the modified files just let me know and I'll send you a copy of it. I think we can use it until the official release with the correction come out.

    Captura de Tela 2017-03-02 às 10.12.57.png

  4. Info 3bits reporter

    If you can create a PR for this issue then we'll review it and merge it in the future version 2. Just verify the code pass Moodle CodeChecker.

  5. Jeremy Hopkins

    I think this may be the best approach, core moodle allows links to be injected into that dropdown list, the only issue is it uses pix icons and not fontawesome so users who have added links with icons may struggle a little.

  6. Jeremy Hopkins

    I have this feature but it is a bit of a work around and needs more work.

    Please see #635 which describes limitations of this fix and proposes moving code into a renderer.

  7. Jeremy Hopkins
    • changed status to open

    Having to re-open this as I forgot to add a capability check to the code, as it stands students will see the links to switch role too.

  8. Jeremy Hopkins

    Thats ok, can you test with the latest version and let me know if its ok.

    I just fixed the issues added to #635 too so it should now return you to the same page.

    I also added a notice to the header with "Return to my normal role" link to make it more obvious if you had switched roles.

    I have also re-factored all the code for the user menu and whllst I have tested it would appreciate it if others could take a look and see if its working for them.

  9. Jeremy Hopkins

    Hi Dirceu,

    Yes that is in the latest version here on Bit Bucket but as this has not been released as such I would avise you test it before putting it onto a live system.

  10. Log in to comment