Remove Log Link From Admin Menu Moodle 3.2

Remove Log Link From Admin Menu Moodle 3.2

by Joseph Alvini -
Number of replies: 3

Hello,

I am currently developing an application using Moodle 3.2. I was wondering if there is a way to remove the "Logs" link in the admin sidebar. I really would rather avoid editing core files so is there any other way to remove that link? I have tried JS but it only works on the sub pages and not the admin landing page due to that sidebar being loaded through AJAX.


Just for clarification this is the link I am trying to remove. Thank you in advance for any help.

Logs Link

Average of ratings: -
In reply to Joseph Alvini

Re: Remove Log Link From Admin Menu Moodle 3.2

by Neill Magill -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers
You could try a local plugin that modifies the settings navigation


An alternative if you don't want anyone to have access to the logs at all you could remove the capabilities from user roles to use the logs altogether (then the links will simply not show either) and avoid any code.

In reply to Neill Magill

Re: Remove Log Link From Admin Menu Moodle 3.2

by Joseph Alvini -

Thats understandable. What do you think would be the best route to take inside of a local plugin to remove a link though? It does sound like a good idea.

In reply to Joseph Alvini

Re: Remove Log Link From Admin Menu Moodle 3.2

by Neill Magill -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

The following would remove the 'Site' node from the standard navigation:

if ($sitepages = $nav->find('site', navigation_node::TYPE_ROOTNODE)) { 
    $sitepages->remove(); 
}

You will want to do something that follows a similar pattern. I imagine the name of the node you are searching for will be something like 'logs' but that may require some experimentation (or finding the code that adds it)