# Forums | Mahara Community

## Developers / main_nav

Posts: 23

11 May 2017, 14:48

Hello

I have this problem. I´ve implemented the local_main_nav_update function into the lib.php file of a personal plugin, to add a menu item as follow:

function local_main_nav_update(&$menu){$menu['courses'] = array(
'path' => 'courses',
'title' => 'Courses',
'url' => 'auth/mymodule/courses.php',
'weight' => 300
);
}

However the item is printed when a user is logged in, but when other page is loaded or the dashborad page is reloaded, the menu item disappears.

Any body know why?

Regards

Posts: 634
##### Re: main_nav

11 May 2017, 17:05

Hi Osbel,

It sounds like you've not quite set things up right.

The local_main_nav_update() function is not meant to added to your plugin but was designed for adding some custom menu items via having a htdocs/local/lib.php file (this file if exists is included for all pages).

Putting it in your plugin means the menu only will show if your plugin is included for the page.

What you should be using within your plugin is the:

See the htdocs/artefact/resume/lib.php for an example

Note: with placing the menus in this way you'll need to use the 'clear cache' button on Admin homepage to get a fresh menu.

Cheers

Robert

Posts: 23
##### Re: main_nav

12 May 2017, 3:28

thank you so much Robert,
Precisely that was the problem and it is already solved
regards
Osbel

3 results