Best way to modify a plugin?

Hi guys,

First off, I'm a new Elgg user and I must commend the developers on how incredible and powerful it is! My question is, say I want to modify the "Profile" plugin (e.g. adding more functionality to the 'profile/icon' view, NOT by changing its look and feel through CSS only) and I have already created a theme plugin myself, can I simply create a 'profile/icon' view within this theme and it will override the 'profile/icon' view? Or do I have to create a duplicate of the existing Profile plugin and modify it accordingly? I don't feel comfortable altering the existing one for fear of security leaks and whatnot. Can you guys please advise? Thanks!

Cheers

  • To override the profile icon view create a new view under your new theme/pluggin and create a 'profile/icon' view within this. this will do the function and will be upgrade friendly too.

  • Hi there thanks for the quick response! I actually have already tried this and it didn't seem to work? Maybe I'm doing it wrong? Here's what I did:

    * Created a theme plugin under "/theme_myplugin" and everything's working as intended

    * Created a view for profile under "/theme_myplugin/views/default/profile" and put in a css.php file to modify appearance. Works fine.

    * Then tried to create a view for profile/icon under "/theme_myplugin/views/default/profile/views/default/profile/icon.php" (basically copied the file from "profile/views/default/profile/icon.php" to my own customer folder and modified the file a bit. This didn't seem to work and my custom file wasn't being invoked :(

    Did I do something wrong? Do I need to register a plugin hook or something? I've also tried disabling and then enabling the plugin as I am aware of plugin caching issues. Please advise. Thanks!

    Cheers

  • After playing around with it a bit more, I found that copying over and duplicating the icon.php file over into "/theme_myplugin/views/default/profile/" and not in "/theme_myplugin/views/default/profile/views/default/profile/" did the trick. Placing it in subdirectories like the latter was redundant. Works a treat now. I also remembered to disable then enable my theme plugin, as adding a new view doesn't get recognised til you do this due to caching issues.

     

  • @Marto

    You mentioned '...have already created a theme plugin myself.." !

    Is your theme uploaded to the Elgg Community so that we can all download it and see ?

  • I'm still in the process of finalising the theme, but once I have I'll upload it for the Elgg community to have a look at. :)

  • @ Marto, there is no need of two vies like /theme_myplugin/views/default/profile/views/default/profile/. it should be /theme_myplugin/views/default/profile/icon.php.