How to add a new tab to Pages only after All, Mine, Friends

In my Elgg 1.8 I'm using two Google map plugins: Map of Members and Share Maps, both of Nikos Lyberakis (http://elgg.lyberakis.gr/).

The first one is showing memebrs on Google Maps, based on "location" field. It's working very well but I didn't like that was adding a Members Map menu, so I wanted to add a simple tab in the Members menu after Newest, Popular, Online.

To do this I worked on the file nav.php in /www/mod/members/views/default/members where i added the following code:

'membersmap' => array(
        'title' => elgg_echo('membersmap:label:map'),
        'url' => "membersmap/map",
        'selected' => $vars['selected'] == 'membersmap',
    ),

Then in /www/mod/members/languages/en.php I added: 'members:label:map' => 'Map',

Finally to remove the "Map of Members" menu I didn't like I changed from "register" to "unregister" the following code in /www/mod/membersmap/start.php

    // Site navigation
    $item = new ElggMenuItem('membersmap', elgg_echo('membersmap:menu'), 'membersmap/all');
    elgg_unregister_menu_item('site', $item);

 

I was very happy and I was immediatelly planning to do the same for the other Share Maps plugin in the Pages menu, but I found out that the Pages menu is working in a different way from the Members one :(

At the moment I have been able to create and modify mod/pages/views/default/page/layouts/content/filter.php so I got my extra tab but this tab is appearing after All, Mine, Friends also in all the other menus such as Activity, Blogs and Bookmarks, but I don't want this!

I was trying to override only mod/pages/ adding views/default/page/layouts/content/filter.php but it's effective also on the other menus :(

Any suggestion how to move on???

As you can see I'm able to read and adjust parts of code but I'm not a programmer nor expert of Elgg so please give me step by step suggestions.

Thanks in advance ;)

  • For example, in mod\pages\pages\pages\world.php

    $body = elgg_view_layout('content', array(
        'filter_context' => 'all',
        'content' => $content,
        'title' => $title,
        'sidebar' => elgg_view('pages/sidebar'),
    ));

     Change 'filter_context' => 'all', on 'sharemaps'

    Done ;)

     

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking