Extending/modifying pages and views instead of overwriting them

HelloI am working on a plugin that extends the core member plugin and I have a lot of trouble getting it to work without overwriting the page files, view files and page_handler itself.

I would like to only extend the regular members list page by an additional tab that allows to filter for a special metadata... and it is working fine so far by overwriting everything, but what if there is another plugin that extends the core members plugin?

I have tried extending views and post processing them as explained here:

http://docs.elgg.org/wiki/Engine/Views

But extending just doesn't seem to work for what I have in mind (e.g adding a tab) and I can't get the post-processing to work at all.

Is there any (relatively simple) example plugin that does something similar?

  • imho, the best approach would be to only override the navigation and point the new tab to a custom page handler, where you can do all post processing.

    It might be a good idea to open a ticket to rewrite the nav.php to use filter menu instead of tabs.

  • Here is the plugin btw:

    http://community.elgg.org/plugins/1484399/0.1/featured-members

    @Ismayil: So you mean instead of overwriting the index.php from the members plugin I create a new page and insert a limited version of my modified index.php? For the page handler I can just use any name then instead of 'members'?

    I was wondering about the difference to the group list that uses '/all?filter=' already... would that avoid having to overwrite the nav view?

  • You can register a new page handler for 'featured_members', and inside the handler set the context to 'members' (in case other plugins use context to add menu items etc)

    If you are not adding more than one tabs, you don't need further filtering or segmentation, but you can either use query parameters as in the example you are listing, e.g. /featured_members?gender=male, or add further segmentation /featured_members/male and add the necessary logic to your page handler

  • Congrats on your first plugin! I have a pull request pending to allow extending that nav view instead of overriding it. It would run the tabs config array through a plugin hook. BTW, placing your plugin code on github would allow other devs to more easily suggest alterations/give feedback.

  • Ahh, great! I assume this is for the upcoming Elgg 1.9 though?

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