What code dictates the content in the sidebar?

Hello fellow Elggers,

What code would I need to alter to add a sidebar to my profile page? More generally: What code is responsible for populating the sidebar on the various pages.

You all rock. Thanks!

  • Hi Eric. I am new to elgg but have been looking at changes to the sidebar for a new theme I am working on and came across your question whilst looking for a similar answer.

    I have been able to add a sidebar to the profile page by changing the default layout from one_column to one_sidebar. I have only tried this by changing the core but obviously I don't want to do that (never change the core) and are working on how to add a sidebar to the profile page of my new theme plugin.

    To add content to the sidebar you need to override the sidebar view but it depends on the sidebar you want to change. I want a new different sidebar just for the profile page.

    Like I said I am new to elgg but when I get it sorted I will let you know how I done it.

  • You need to change the layout and override/extend view used in sidebar.

    Overriding the layout alternatives:

    • Register your own page handler (elgg_register_page_handler) and reimplement it using different layout
    • Tap to plugin hook 'route','profile' and override only the case you're intrested in

    Adding custom content can be done by extending (elgg_extend_view) or overriding one of the views:

    • page/elements/sidebar
    • page/elements/owner_block

    Use priority to add extension before or after the view.

  • Hi Pawel. Thanks for the help. I will see how I get on with this today and hopefully have no problems.