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

Release Notes

Changelog:

  • Added cache urls for css and js to allowed urls (thanks Hector),
  • fixed a deprecated function issue I had missed in start.php.

Tested in Elgg 1.8.1 and newer.

  • Hey iionly, thanks for that plugin.

    I have elgg_social_login (to authenticate from twitter, facebook, google+, etc) but my users cant authenticate, cause they needed to be logged in, to use elgg_social_login. How can I allow it ? Tried a lot, but nothing works :(

  • Same here, Ilonly. Any help will be appreciated.

  • @Opteron & Sem: I guess you need to add a page or view to the array of allowed pages in start.php. It might help to look at the browser's address bar to find out what page(s) the social login plugin is redirecting to. Otherwise, you might need to investigate the start.php of that plugin to find out what page handlers get definded by the plugin or what views get modified. It might also be necessary to add the css directory of this plugin for the login to work - in case it has its own css.

  • I added this:

    $add[] = '*/mod/elgg_social_login/authenticate.php*';

    it seems like its working, i see the connecting page, but then it goes to the login page. I think i have to add the page which is be loaded after connecting, the facebook-authenticatepage for example. I am using Facebook Connect 1.8 now and it works fine. But elgg_social_connect would be nicer.

  • @Opteron: I have never tested neither the Facebook Connect 1.8 nor the elgg_social_connect plugin, so I am not sure I understand you correctly. Does the Facebook Connect plugin work without any modifications of the Login required plugin? Adding

    $add[] = '*/mod/elgg_social_login/authenticate.php*';

    is for the elgg_social_connect plugin but it still doesn't work then?

  • i tried facebook, twitter, g+, yahoo and aol, same there.

    changed the order (login_required at the bottom) still same. :(

    the modification crashed my elgg, i will test it tomorrow again

     

     

  • @Opteron:

    Well, I thought it would not work to connect a test installation that's hosted locally but it worked for Twitter at least. I added these lines to the allowed URLs (function login_required_default_allowed_list() in start.php):

    $add[] = 'mod/elgg_social_login/authenticate.php*';
    $add[] = 'mod/elgg_social_login/vendors/hybridauth*';

    I think this should also work for the other sites. Can you confirm?

  • it works !! thank you for your support !!

  • @iionly how to allow a elgg 1.8.3 404 error page?

  • @lee look n the start.pphp file

  • @Flexx i see stat.php its have allow url

    In elgg 1.8.3 for wrong page for 404 error page there no url name?


  • @lee:

    Viewing the external site pages (about, terms privacy) is already allowed.

    As for allowing to view the 404 pages (or custom Elgg error pages) I'm not sure it's possible when logged out. Though it does work when logged in as the Loginrequired plugin doesn't block any views when logged in anyway. As you already mentioned there is no specific url to allow for pages that don't exist (404 error). Elgg only extends the view of the faulty unknown url in case of an error occuring, so it won't help to allow the error views itself to be displayed for logged-out visitors.

    On the other hand, I don't see much sense in allowing custom error pages to be shown for people not logged in when they try to access a non-existing page, if you use the Loginrequired plugin or any other walled-garden mechanism. The purpose of the walled-garden approach is to block general access and only allow access to a few specific - and existing - pages. If people are trying to access any other pages - existing or not - they are re-directed to the login page if they are not logged in. Even in case they were trying to access an existing page (that is not included in the list of allowed urls) they would get redirected to the login page anyway.

  • Hey iionly, i did a bit of mod to this plugin right, ( I place the member's pictures at the top) but sometimes when i (or a user) tries to log in it takes you to the default (eg: http://site.com/_graphics/icons/user/defaultmedium.gif) picture url instead if the index page, would you know what cause that?

  • it coud be the exact sequening of the permsisisons being applied- the default somes thru if the permission is defined too lacte - but we'll need to look at all the code and code steps to confirm..

     

  • @Flexx: As Dhrup said it's difficult to give you an advice without further details / code. What have you modified exactly and what do you want to achieve? Do you want to display a list of latest new members, members currently logged in or the single icon of the member that is logging in (though I don't know how you would want to achive this as the Loginrequired plugin does only deal with what happens prior logging in and you won't know who is logging in at this point yet). Are the member icons clickable (linked to the profile or icon entity) or are only the avatar images displayed? Does the redirect happen only after an icon is being clicked prior the login (then this icon would be loaded after the login). Does it happen only when the icon(s) to be displayed include the default icon, i.e. at least one members hasn't uploaded a custom icon?

  • "Does it happen only when the icon(s) to be displayed include the default icon, i.e. at least one members hasn't uploaded a custom icon?"

    That is the problem i have after a few more test I realive that if there is a default icon being displayed on the page, it goes to the default icon, but when an icon is uploaded it works ok.

  • @Flexx: I still don't know what exactly you are trying to achive as you haven't mentioned it. Who's members' icons are you trying to display on the login page? Please keep in mind that the Loginrequired plugin is only meant to display a front page PRIOR login. At this point the member account of the person who logs in is not yet known. If you simply want to add a list of latest new members who joined the site on the login front page you add the code used in the custom_index plugin. This will add a widget that displays the icons of the latest new members - and only the members who have uploaded a profile icon. I just did some testing and the code works. Though you can't follow the link to the profile pages as this will get blocked by the Loginrequired plugin.

    If you want to add any icon(s) of the user who logs in or people currently logged in, it's better to modify the custom_index plugin code (or any other plugin code that creates the index page after login).

  • "If you simply want to add a list of latest new members who joined the site on the login front page"

    Thats what i did and when a user does not upload a picture and a user tries to log in it sometimes take you to the link i mentioned above. have you tested it with the default icon? Sometimes it happens when you hover over the icon then loggeds in..

     

  • @Flexx:

    There is more than one way to implement the list of latest members to be displayed. For example the custom_index plugin will display a widget with the latest new members, but only the members who have uploaded their own custom profile icon (code to include this widget on the index page is in "mod/custom_index/index.php" and "mod/custom_index/views/default/page/layouts/custom_index.php"). You can take the corresponding code and add it to the corresponding files of the Loginrequired plugin.

    If you want to list the latest members regardless if they have uploaded their own profile icon or not, you can add these lines

    $members = elgg_list_entities(array('type' => 'user', 'limit' => 10));
    echo elgg_view_module('featured',  elgg_echo("custom:members"), $members, $mod_params);

    to "mod/loginrequired/views/default/page/layouts/loginrequired_index.php". This will list the latest 10 new members. With both of these ways to show the latest members clicking on the profile icon would bring you to the profile page of this member. But with the Loginrequired plugin enabled you need to be logged in for the forward to work - and this is the purpose of the Loginrequired plugin after all, i.e. the necessity to be logged in to view the site content. Elgg/Loginrequired plugin remembers the page you wanted to visit and therefore you will get redirected to the profile page of the corresponding user in case you have clicked on one the profile icons / member name.

    I don't know how exactly you implemented the display of the latest members on your site. You mentioned that you get redirected to the default profile icon in case you hovered over an icon. I guess that you might also get redirected to the profile icon of a member when he has uploaded his own image. I guess in your implementation you include the object view of the profile image and as mentioned above Elgg remembers what view you wanted to be displayed and therefore shows a page with only that view after you have logged in. You might be able to avoid the redirect, if you include only the profile icon image and don't make the image a link.

  • hey iionly how would i allow logged out user to be able to see users profile? I tried allow ='. "profile/" . $user->username;'; but it didnt work..

  • @Flexx: to give anonymous visitors access to profile pages add:

      $add[] = 'profile/.*';

    to the list of allowed pages in Loginrequired's start.php. Apart from the user's info block only widgets set to public will be visible though. Addtionally, inside widgets only public content will be visible. This behaviour is not controlled by the Loginrequired plugin but by Elgg core.

  • Ok thanks, My reason for this is to have a kind of facebook like settings.. users allow what others see etc. Also ill take a look into adding the list of members who upload pictures instead of the one im using cuz its a pain!

  • This is the code i use

    $newest_members = elgg_list_entities_from_metadata(array(
        'metadata_names' => 'icontime',
        'types' => 'user',
        'limit' => 8,
        'full_view' => false,
        'pagination' => false,
        'list_type' => 'gallery',
        'gallery_class' => 'elgg-gallery-users',
        'size' => 'medium',
    ));

     

    The problem is when users uses facebook they pictures arnt saved on my site, i think it might have t do with the social login plugin..

Stats

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

Other Projects

View iionly's plugins