walled-garden.rst 1.6 KB

12345678910111213141516171819202122232425262728293031
  1. Walled Garden
  2. =============
  3. Elgg supports a "Walled Garden" mode. In this mode, almost all pages are restricted to logged in users. This is useful for sites that don't allow public registration.
  4. Activating Walled Garden mode
  5. -----------------------------
  6. To activate Walled Garden mode in Elgg 1.8, go to the Administration section. On the right sidebar menu, under the "Configure" section, expand "Settings," then click on "Advanced."
  7. From the Advanced Settings page, find the option labelled "Restrict pages to logged-in users." Enable this option, then click "Save" to switch your site into Walled Garden mode.
  8. Exposing pages through Walled Gardens
  9. -------------------------------------
  10. Many plugins extend Elgg by adding pages. Walled Garden mode will prevent these pages from being viewed by logged out users. Elgg uses :ref:`plugin hook <design/events#plugin-hooks>` to manage which pages are visible through the Walled Garden.
  11. Plugin authors must register pages as public if they should be viewable through Walled Gardens by responding to the ``public_pages``, ``walled_garden`` plugin hook.
  12. The returned value is an array of regexp expressions for public pages.
  13. The following code shows how to expose http://example.org/my_plugin/public_page through a Walled Garden. This assumes the plugin has registered a :doc:`pagehandler` for ``my_plugin``.
  14. .. code:: php
  15. elgg_register_plugin_hook_handler('public_pages', 'walled_garden', 'my_plugin_walled_garden_public_pages');
  16. function my_plugin_walled_garden_public_pages($hook, $type, $pages) {
  17. $pages[] = 'my_plugin/public_page';
  18. return $pages;
  19. }