Theme Essential: Customize User Menu on Top

Theme Essential: Customize User Menu on Top

Uchendu Nwachukwu -
回帖数:19

Hi,

I'm currently trying to customize my user menu that is displayed on top.


My goal is to remove/hide the items Preferences, Messages, Forum posts and Discussions. Addtionally I would like to add a Edit profil item. I think I made the right settings in the backend since in the moodle default theme it seems to work as expected


I already found an older forum post where it is written that I have to make some changes in the theme code: 
https://moodle.org/mod/forum/discuss.php?d=238022

I think this doesn't count anymore since I can't even find the renderers.php file in my essential theme folder...

Any suggestions?


Additional information

Moodle version: 3.1.1

Essential theme version: 3.1.0.5

Customization in the backend made:

  • disabled nearly all permissions  for students and authenticated users. E.g everything in connection with badges, messages
  • disabled private files (system administration/plugins/repositories/manage repositories
  • adjust the user menu in theme settings => https://docs.moodle.org/31/en/Theme_settings#User_menu_items


回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Mary Evans -

Hi,

Very complex theme so be careful...but I think the code you are looking for is here...

https://github.com/gjb2048/moodle-theme_essential/blob/master/classes/output/core_renderer.php#L1261-L1439

Check essential/lib.php file too as that may have reference to the function named at the top of that list,

Hope that helps?

Mary

回复Mary Evans

Re: Theme Essential: Customize User Menu on Top

Uchendu Nwachukwu -

Thank you for the quick and helpful answer!

Your link allowed me to see which permissions are checked by the plugin. I'm pretty satisfied how it looks right now. 


I'm gonna let it stay like that since the preferences menu can't be hidden without editing the core and I'm just lazy... And there are some other reasons: After changing the password over yoursite.com/moodle/login/change_password.php you are redirected to the preference site. For me this would be confusing if you can't enter this site on another way.

Thanks again for you help!


Short summary what I have disallowed in order to hide an item from the user menu

Calendar: moodle/calendar:manageownentries

Messaging: Site Administration>Advanced Features - unchecking messaging

Private files: moodle/user:manageownfiles (additionally disabled private files entirely: site admin>plugins>repositories>manage repositories)

Forum posts and Disscussion (both depend on same permission): mod/forum:viewdiscussion 

Grades: gradereport/overview:view

Course grades: gradereport/user:view

Badges: moodle/badges:manageownbadges

Permissions are changed for Students, Authenticated Users AND Authenticated Users on frontpage

If the Authenticated users on frontpage isn't changed they will see a different user menu on the frontpage since some permissions are specified in this role as well. 

Sometimes the permission needs to be changed by multiple roles!

回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Gareth J Barnard -
Core developers的头像 Particularly helpful Moodlers的头像 Plugin developers的头像

Ok,

The preferences menu has another set of capabilities: https://github.com/gjb2048/moodle-theme_essential/blob/master/classes/output/core_renderer.php#L1498-L1539 and therefore elements of it can be removed without editing the code (its a 'plugin' not 'core').

With 'After changing the password over yoursite.com/moodle/login/change_password.php you are redirected to the preference site.' I don't believe this is an Essential thing as the code has no control over this.  Please see if the Clean theme does the same too and report a Moodle Tracker issue (if not one already).

I know the docs for the theme are out of date, just no time to do this, if anybody would like to adjust them then please do.

G

回复Gareth J Barnard

Re: Theme Essential: Customize User Menu on Top

Uchendu Nwachukwu -

Thank you for the further information about the preferences menu. I have disabled blog in the System Administration/Advanced features. Now there are only menu items left that I want to display.

Your absolutly right. In order to hide the preference menu entirely the code of the plugin needs to be adjusted. The redirection after changing the password is defined here: https://github.com/moodle/moodle/blob/master/login/change_password.php#L44-L55
Same would be necessary for some other pages like editing a profile.

I already placed once a redirect in the preferences.php but i think this page isn't that bad anymore since most of the options are disabled so I deleted the redirect again.


回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Manny Pitta -

Thank you to everyone contributing to this discussion. I noticed that there is also a redirect to the preferences page if the password change is cancelled. That is on ~line 113.

回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Raffaele Di Meo -

Hi Uchendu,

This was very useful! Thanks for asking the question in the first place and for providing a solution too.

I have manged to disable most of the links that I didn't need, but still finding difficult to disable my grades. I have looked into the user permission and grade overview report is not allowed - this is for authenticated user as well as for students. 

What could be a solution to disable 'My Grades' from the user menu?



回复Raffaele Di Meo

Re: Theme Essential: Customize User Menu on Top

Uchendu Nwachukwu -

Disable: gradereport/overview:view

回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Raffaele Di Meo -

Thanks for your reply Uchendu. I believe that you are referring to the user permissions. I have select 'prohibit' for students,  authenticated users on the home page and authenticated user but my grades keeps appearing in user menu.


As you can see from the screenshots, this is fine on the course page but appears on the home page and dashborard which is odd.

    


Any suggestions?



回复Raffaele Di Meo

Re: Theme Essential: Customize User Menu on Top

Uchendu Nwachukwu -

Hi Raffaele

Did you check once the capability overview for "gradereport/overview:view" to make sure that it is set right?
(Site administration => Users => Permission => Capability Overview)

回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Raffaele Di Meo -
I did and it looks fine to me but I guess I am missing something... your help is much appreciated.
I have attached an image that shows the settings.

Screenshot Capability overview

Thanks,
Raff
回复Raffaele Di Meo

Re: Theme Essential: Customize User Menu on Top

catherine Baernardo -

hello i have the same problem  im trying to figure out how ..

can you be specific on how did you do it thanks 

im using moodle 3.0


回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

Mewael Ghebreslassie -

Great tips!

Any idea how you can remove the " My Grades" tab that users see once the log in ( see attached)? I was able to prevent permissions for all grade reports but this only hides the tab for when users access courses.  


附件 usermenu_now.PNG
回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

catherine Baernardo -

hello i have the same problem trying to remove some menu on top but cant figure how 

im currently using moodle 3.0


回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

catherine Baernardo -

hello thanks for this question i would really appreciate it if you give some details on how you did it i am new to moodle and i didnt get you thank you in advanced


回复Uchendu Nwachukwu

Re: Theme Essential: Customize User Menu on Top

catherine Baernardo -

hello thanks for this question i would really appreciate it if you give some details on how you did it i am new to moodle and i didnt get you thank you in advanced


回复Mary Evans

Re: Theme Essential: Customize User Menu on Top

Santiago Garcia -
Hello MAry, sorry to bother you but I cant find an answer to a problem but I know you are a theme guru. I bought a theme without the user menu on the top. I am using moodle 3.2 and I wanted to add the menu back to the theme, Is it a quick thing to do? Thanks for your time


回复Santiago Garcia

Re: Theme Essential: Customize User Menu on Top

Richard Oelmann -
Core developers的头像 Plugin developers的头像 Testers的头像

TBH, if you bought a theme, then your first point of contact should be the theme author/site you bought it from. They should be able to provide support for their theme.

回复Santiago Garcia

Re: Theme Essential: Customize User Menu on Top

Mary Evans -

Hi,

It's my birthday today...so I won't be about for most of the day. But to answer your question. If you have access to your theme, which you must have, then just add the following into the header of the layout file or files, depending on if they are like most Moodle Themes.

Here is a link to Moodle 3.3 the lin in the code I have linked to is Line 50

https://github.com/lazydaisy/moodle/blob/MOODLE_33_STABLE/theme/bootstrapbase/layout/columns3.php#L50

Hope this helps?

Mary