[Elgg 1.8-1.12 & 2.X: Login required] v1.9.8

Release Notes

  • Adjustments in default allowed pages for Loginrequired to work both on Elgg 1.9 - 1.12 and Elgg 2.0 (therefore should work on any Elgg 2.X version),
  • composer.json added to allow for composer based installs.
  • Plugin is good and works more on my main page when it is not logged in ... I have a mosaic with photos of all members. When active does not load as thumbnails photos of the members. There is a solution or a hint on how to allow upload as profile photos and thank you.
  • If your plugin adds its own index page, you should place this plugin below the Login Required plugin and your plugin should override the index page with its own.

    If your plugin does not create its own index page, you can customize the index page created by the Login Required plugin by modifying mod/loginrequired/views/default/page/layouts/loginrequired_index.php (and if necessary mod/loginrequired/index.php).

    If the user images are not visible when logged out, you might need to add some pagehandler identifier to the array of allowed identifiers in the login_required_default_allowed_list() function in start.php of the Login Required plugin (but if this is necessary or not depends on the plugin used for the user avatar mosaric).

  • Thanks iionly for your help. I tried here but I did not succeed. When disconnected I have login box and I have 5 images in slider and I have mosiac of members with avatar that I put based on the plugin members. I tried to raise what he said but the page is completely unconfigured so I decided not to use the plugin while I have this mosaic. The mosaic is the attraction of those who visit. but thanks.
  • Have you added your own code for the members mosaic or are you using a plugin? Without knowing how you do it I can't make any suggestions how to fix it.

  • thanks for listening. I'll try to explain. I use silverblue elggzone theme. This theme has several options when logged in or not logged in. When not logged in I have slider image, logine box etc. When logged in I have on the main page several widgets like: members, groups and etc. Besides having the members widget when logged in, I put widget members also when not logged in. Then it appears to the members with avatar when not logged looking like a mosaic but it is not the mosaic plugin. 

    Below I will put a snippet of code that is in mod / silverblue / views / default / page / layouts / silverblue_index.php $ Mod_params = array ('class' => 'elgg-module-highlight'); // get index setting $ Index_setting = elgg_get_plugin_setting ('index_setting', 'silverblue');


    // members         Echo elgg_view_module ('featured', elgg_echo ("silverblue: members"), $ vars ['members'], (Here exsite inside the if when logged in so I put out the if as well. So it appears on the page not logged in.)

    $ mod_params);

    If ($ index_setting == 'slide' &&! Elgg_is_logged_in ()) {

    Echo elgg_view_module ('featured', elgg_echo ("silverblue: members"), $ vars ['members'],






  • I believe the login_required plugin did not count which plugin members could be called when not logged in. Then login_required prevents member avatar from loading. The avatars images do not load.  
    As it gets when active plugin login required. below:



  • The code you posted isn't any help for me to understand how exactly the members mosaic is implemented on your site.

    If I try it with changing mod/loginrequired/views/default/page/layouts/loginrequired_index.php into

     * Loginrequired Login page layout
    $mod_params = array('class' => 'elgg-module-highlight');
    <div class="loginrequired-index elgg-main elgg-grid clearfix">
        <div class="elgg-col elgg-col-1of2 loginrequired-index-col1">
            <div class="elgg-inner pvm">
    // left column
                $top_box = $vars['login'];
                echo elgg_view_module('featured',  '', $top_box, $mod_params);
                echo elgg_view("index/lefthandside");
        <div class="elgg-col elgg-col-1of2 loginrequired-index-col2">
            <div class="elgg-inner pvm">
    // right column
                // a view for plugins to extend
                echo elgg_view("index/righthandside");
                $newest_members = elgg_list_entities_from_metadata(array(
                    'metadata_names' => 'icontime',
                    'type' => 'user',
                    'limit' => 10,
                    'full_view' => false,
                    'pagination' => false,
                    'list_type' => 'gallery',
                    'gallery_class' => 'elgg-gallery-users',
                    'size' => 'small',
                echo elgg_view_module('featured',  elgg_echo("custom:members"), $newest_members, $mod_params);

    I get a members widget with the profile images showing (though the link to the profile pages will not work with the Login Required plugin as this would be against the purpose of the plugin of blocking access for logged-out visitors).

  • Thank you very much. But it did not work. I'll leave it as it is. Access is limited. I'm going to end this mosaic of men later. Although it attracts more members to my network.
  • Sorry I couldn't help you. I have no idea why it works for me but not for you.

  • Hi all,

    I am trying out the loginrequired plugin on Elgg 2.3.5. The idea is; rather than using default walled garden functionality, to use the loginrequired to selectively open up parts of a site, like blogs.  Then the users would decide whether to make their posts public or not on individual basis. I have added the blog and blog/.* in the login_required_default_allowed_list in start.php. But after logging in, when I try to create a new blog or update an existing blog to set the access to public, I can't do it because 'public' is not displayed in the drop down list. And the existing blogs are not visible to non-loggedin users because none of them are public.

    What am I doing wrong?


  • I'm on holiday until next week. Can't give any detailed help before.

  • The Loginrequired plugin makes all pages non-public by default with the exception to those you make "public pages" explicitely. Nonetheless, not all content within these public pages is necessarily public. Content access is still controlled by its content item specific access level.

    As the original intention of the Loginrequired plugin is to make content not accessible for logged-out visitors the "public" access level is unset (as the content wouldn't be accessible when logged-out if access to the whole page is blocked anyway).

    If you want to grant access to certain pages, you need to make these pages public by adding their urls to the array in the login_required_default_allowed_list() function (as you already did). If you also want content objects (like a blog posting) have a public access level, you would need to not unset the public access level from the available access level. To do this you would have to comment out the lines

        if (elgg_get_config('default_access') == ACCESS_PUBLIC) {
            elgg_save_config('default_access', ACCESS_LOGGED_IN);
        elgg_register_plugin_hook_handler('access:collections:write', 'all', 'loginrequired_remove_public_access', 9999);

    in the init function in start.php and remove the file mod/loginrequired/views/default/groups/edit/access.php (if you also want to re-add the public access level for group content as this files just overrides the Elgg core version of this file without offering the public access level). It would be more complex if you want to re-add the public access level only for specific content. In this case you would have to modify the function loginrequired_remove_public_access() and the file mod/loginrequired/views/default/groups/edit/access.php according to your needs (but that is a matter I can't give any more specific hints as there are many ways to change the code).

    For any existing content item that should be accessible for logged-out users you would have to edit it to change the access level to public then after you have no longer unset the public access level.


  • Category: Misc
  • License: GNU General Public License (GPL) version 2
  • Updated: 2016-12-11
  • Downloads: 8219
  • Recommendations: 26

Other Projects

View iionly's plugins