Adding link to user preferences in Shoehorn user drop down menu

Adding link to user preferences in Shoehorn user drop down menu

by Hartmut Scherer -
Number of replies: 3

Hi all,

Just want to share how to add a link to preferences in the user drop down menu at the top right of Shoehorn.

I added the following code in shoehorn\classes\core_renderer.php after line 562:

                 $preferencestext = get_string('preferences');

                if ($this->fontawesome) {

                    $preferences = html_writer::tag('i', '', array('class' => 'fa fa-key'));

                } else {

                    $preferences = html_writer::tag('span', '', array('class' => 'glyphicon glyphicon-cog'));

                }

                $preferences .= html_writer::tag('span', $preferencestext);

                $usermenu->add(

                    $preferences,

                    new moodle_url('/user/preferences.php', array('id' => $USER->id)),

                    $preferencestext

                );

In a test site it looks like this:

new link to preferences








With kind regards,

Hartmut


Average of ratings: Useful (1)
In reply to Hartmut Scherer

Re: Adding link to user preferences in Shoehorn user drop down menu

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Hartmut,

I've added your code in the latest release (V2.9.1.3): https://moodle.org/mod/forum/discuss.php?d=320256

Cheers,

Gareth

In reply to Gareth J Barnard

Re: Adding link to user preferences in Shoehorn user drop down menu

by Hartmut Scherer -

Hi Gareth,

I am fascinated by your fast response and that you implemented the suggestions for quiz and preferences. Thank you for providing and maintaining this theme. 

With kind regards,

Hartmut

In reply to Hartmut Scherer

Re: Adding link to user preferences in Shoehorn user drop down menu

by Gareth J Barnard -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Hi Hartmut,

I find that coding can be relaxing and in this case I wanted to make the improvement smile.

Cheers,

Gareth