Newbie Plugin Developement - Help needed

Hi all,

I am new to ELGG plugin developement. To be more precise I am new to open source arena. I am a Mainframe developer whose life is spent on COBOL and REXX :) .

I am currently trying to create a new plugin for the ELGG users. I had a look on the ELGG tutorials. But it does not help me in any ways. Based on the self study and trial and error method, I have managed to create a basic plugin, which does nothing. (It accepts some settings thru Settings).

I want to override the a particular view in my mod without affecting its current features. How should I do this?

Any links and documents on basic plugin development is welcomed.

Thanks in advance.

  • Thanks to Elgg's view system, overriding views of the Elgg core (elgg/views) or the plugins (elgg/mod/pluginname/views) is really easy.

    Just copy the view from the original location to the views diectory of your own plugin with the same same name and directory structure and your plugin's view automatically overrides the original view.

    The view which is used is defined by the plugin order in the administrator's plugin list. So place your own plugin after the original one in the list. Otherwise your plugin's view won't override the original one.

    If you want to modify the contents of the blog widget you can copy the file:


    To the views directory of your own plugin:


    And then make the needed modifications to this file.

    Here's some more about overriding and extending views (if you haven't already read this): 

    I hope this was helpful!

  • Thanks Juho.

    So if I need to modify any file, I should create the same file in the same structure. isn't it?

    I wanted to keep some HTML tags code chunk at the end of the file(footer.php), but in this file, the php code tag is not present at the end (?>), so if I place HTML tags at the end, no pages comes up.


    " Php code tag is not present at the end (?>) "  does not matter
    unless you want to add more html after that --
    in that case put into the ending  ?>  before your new html code.

    Google for "php html embedding mixture" for many examples
    of Php + HTML mixed code ;)

    " (override) extending views in mod without affecting current features.. " 
    Have a look at existing plugin(s) to see examples of this.
    e.g. File PlugIn start.php --
    // Extend CSS
    elgg_extend_view('css', 'file/css');

    Cobol & Rexx LOLZ ;-) I did IBM MF myself 1977-2008, switching
    to Web stuff / PHP, etc over 1998--2002. It's not so hard to
    make switch, But trad Cobol style thinking does not help unless
    you're used to OO-Cobol or Object-Rexx ;-P Then..
    the PHP objects,classes, MVC become much easier..



  • Thanks DDS :) Happy to know that you too an Black & Green screen guy :P

    I am going to try a new plugin based on these tips from you guys :)

  • Hi all,

    I am currently learning to develop basic plugins. I just want to print a hard-coded text along with the existing text of the footer. Here is my requirement for which I am really struggling.. :(

    File to be overriden: /public_html/views/default/page/elements/footer.php

    I have create a folder mod_name under the mod folder and have the following in the start.php file.

        function mod_name_init()
        // Extend the current footer to have the extended details
        elgg_extend_view('page/elements/footer', ',mod_name/views/default/page/elements/footer');

    Should I copy the contents of the core footer.php file to my mod's footer.php and add my ECHO statement as the "extra" statement? If so, how it can be called as extending? I understand from the function name elgg_extend_view that the contents of the second view will be appended to the actual view.

    Please help me to start with my first ever plugin :)

  • Your code is trying to both override and extend the file at the same time. Choose which one you want to do.

    To override the whole file with your own, it's enough just to have a file with the same name in your plugin's views directory in the same directory path. You don't have to use elgg_extend_view() at all. It's enough that your plugin is enabled and it is located after the original plugin in the administrator's plugin list.

    If you just want to extend the original view by placing your own code to the end of the original file create the extension file to your own plugin's view directory:


    And then extend the original view with that one in the mod_name_init:

     elgg_extend_view('page/elements/footer', 'mod_name/footer_extension');

    (Notice, that I didn't use the whole path in the second parameter but just the bolded part!)

  • Thanks Juho. It worked perfectly as I wished.

    I am extending the default content of the footer.php which comes with the ELGG 1.8 default theme.

    If someother theme is used, the footer file will be different, right? In this my mod will take the footer of the current theme(non-default theme) and extended it to my mod?

    With the basic knowledge I have as of now, I have created a new plugin. Can you have a look on the code and correct me if I am correct? Have attached the mod in the below link.

    Thanks again.

  • Congrats for your first code purus. The code seems ok except for the following.

    • To get the plugin setting's value use elgg_get_plugin_setting('name_of_value', 'name_of_plugin')
    • You dont need to call the glbal $CONFIG, in 1.8
    • Use language file for adding translations.

    There wont be a problem with anyother theme, if you are extending the footer. But if you override a view and some other plugin is overriding the same view, then the lowest placed plugin will be having higher priority.

  • Thanks Webgalli for your feedback. Once I make these changes, I will upload the Google Analytics plugin to the community.


  • Hi Webgalli and Juho and others,

    I have uploaded my first ELGG plugin. Please recommend if you like it.