Exposing pages through Walled Gardens

Hi, I found exposing method to expose pages through walled garden here - https://learn.elgg.org/en/stable/guides/walled-garden.html

There is code:

elgg_register_route('my_plugin:public_page', [
    'path' => '/my_plugin/public_page',
    'resource' => 'my_plugin/public_page',
    'walled' => false,


So when I want to expose wole blog then this code is like below?:

elgg_register_route('blog', [
    'path' => 'blog',
    'resource' => 'blog',
    'walled' => false,

It doesnt work for me.

Second question where i must paste this code, i tried to paste it in blog in elgg-plugin.php file

  • What you need to do is reregister the blog routes with the additional flag 'walled => false'.

    This can be done in your elgg-plugin.php, copy the routes (exactly) from the blog plugins elgg-plugin.php and add them in the section 'routes' in your elgg-plugin.php.

    You'll probably don't need all routes from the blog plugin, but most.

    • collection:object:blog:owner
    • collection:object:blog:friends
    • view:object:blog
    • collection:object:blog:group
    • collection:object:blog:all
    • default:object:blog

    Make sure your plugin is below the Blog plugin in the plugin list.

    Or you could register an event listener in a plugin bootstrap in the boot function for the event 'route:config', 'the list from above', then you can change the config for that route to add 'walled => false'.

  • Thank you for your respond.

    So I must for example for the path

    add below code in elgg-plugin.php - or my understanding of this problem is horrible wrong?

    elgg_register_route('view:object:blog', [
        'path' => '/blog/view/{guid}/{title?}',
        'resource' => 'blog/view',
        'walled' => false,

  • In elgg-plugin.php:

    'routes' => [
        'view:object:blog' => [
             'path' => '/blog/view/{guid}/{title?}',
             'resource' => 'blog/view',
             'walled' => false,
    The best way is to look at the code of ready-made plugins ;)

    Nikolai Shcherbin, yes I tried this way as you wrote.

    But when I made this like this way still cant get to this section on site when log out and still is error shown that dont have permission BUT there isn't login section.

    So making this like you wrote only makes that login section isn't shown but still cant see the content.

  • ok this working fine. Now the problem is status of the blog post. Posts with "public" status are shown right way!

    Thank you!

  • Of course, blog posts with a non-public access level ('status' you mentioned) will not be displayed even if you're going to cancel the walled garden 

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