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

Release Notes

Changelog:

  • Upgraded for Elgg 1.8.1.
  • I would want some more explanation how this works. I used it and changed to if a non-logged in user got to the page, it would only see my advertising page (just for testing). Instead it displayed the same default page, now with restricted object which shouldnt be displayed with your code.

    I am only using it so i can change the default page. (the page you see when you log out, or you havent logged in yet). I want to make a frontpage which sells my site, and why new users should register.

    Awesome if you could message the reply..:D

  • @Kapten: The Loginrequired plugin includes it own "custom_index" page that is shown when not logged in. Basically, I modified the index page included in the bundled custom_index plugin. This index page is only used when not logged in. If logged in, the normal index page or whatever page the site visitor is viewing is displayed.

    If you create another index page within another plugin and this other plugin has a higher priority, it could interfere with the Loginrequired plugin. There also could occur conflicts with site themes that override certain views of the Loginrequired plugin. If you want your advertising page to be viewable for logged-out visitors, you could include the relevant code within the Loginrequired index page. The files to modify are

    loginrequired/index.php and

    loginrequired/views/default/page/layouts/loginrequired_index.php

    I don't know exactly what you mean with restricted object showing when not logged in, but I assume that the advertising stuff was not shown because of Elgg's permission mechanism. For an object to be shown for logged-out visitors this object needs to have "public" permissions.

  • Hello everybody, I'm new with Elgg. I have a problem with this plugin. I made an small change, and I'm getting a big error. In the index.php file, for this plugin, I changed the code to :

    <?php
    /**
     * Elgg index page for web-based applications
     *
     * @package Elgg
     * @subpackage Core
     */

    //grab the login form
    $login = elgg_view("engine/start");

    $params = array(
            'login'  => $login
    );
    $body = elgg_view_layout('custom_index', $params);
    echo elgg_view_page(null, $body);

     

    In order to show the custom_index for current theme. It works great on my localhost, but when I make that changes in the online site, an try to log in later, then it show a css file, follow this link:

    http://www.swdates.com/cache/css/default/vendors/jquery/ui/theme.1326390550.css

    the first lines of this files, says:

    /*
     * jQuery UI CSS Framework 1.8.16
     *
     * Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
     * Dual licensed under the MIT or GPL Version 2 licenses.
     * http://jquery.org/license
     *
     * http://docs.jquery.com/UI/Theming/API
     *
     * To view and modify this theme, visit http://jqueryui.com/themeroller/
     */


    Why this? and why when I change only those line of code?

    Thanks in advance, and sorry for my english,

    Hector
  • @Hector:

    Your modified line

    $login = elgg_view("engine/start");

    is surely wrong. "engine/start" is surely not an allowed Elgg view. You must provide a correct view here to provide the login form. The original line included the unmodified core Elgg login form. If you want to use the unchanged login form include the original line again. If you have your own custom login form (for example included in another plugin/theme) provide the correct view path to that login form. This would look for a plugin "my_theme" with the login form for example in mod/my_theme/views/default/my_views/account/login_box.php like

    $login = elgg_view("my_views/account/login_box");

    I can't surely say, If the second modification

    $body = elgg_view_layout('custom_index', $params);

    will work or not. This depends what code is included in the custom_index page layout. The original custom_index plugin page layout is depending to a certain extend on its index.php file. This might be still the case with your custom_index layout both if it's the bundled custom_index plugin layout or included in a 3rd party plugin.

  •   @iionly, I'm sorry, I though was due to my changes, but I tried with the original plugin, and still having the same problem. I think the problem is with frei-chat, because the css file that I get in the error, is from that plugin. I'll keep trying, but now even if I delete the chat plugin, the problem remains, all the plugins are in the original way, and still having problems...

    Kind regards, Hector

  • How exactly have you deleted the chat plugin? Have you disabled it in the admin section or just deleted the folder from the server?

    Running http://<yoursite.url>/upgrade.php might help as your site cache has maybe not been updated after removal of the plugin, i.e. the css is still cached.

    Do you have exactly the same site configuration / plugins in localhost and on your server?

     

  •  Hello, well, finally the problem looks like solved. The problem was the start.php fo this plugin, in the array where you keep the allowed pages, i had to add a couple of lines:

     

    $allow[] = 'cache/css/.*';
    $allow[] = 'cache/js/.*';

    after this, no more problems with that css in cache... so, the problem seems to be an access problem.

     In the other hand, the code I put previously, abolutely works, I can't say that "engine/start" exits as a view, because, I'm totally newbie with Elgg. But my intention was to show the home page, not the login view, because there in the home page, (custom_index of my current theme), is a login way already.

     Thanks @iionly for your help, I think you should include those line on the plugins, as they are include as default allowed pages in the ElggSite.php file, of the engine.

    Thanks for your great job... !!

    Hector

  • Thanks for the feedback. But the cache folder does not exist in a default Elgg 1.8 installation. I assume that it gets created when installing the frei-chat plugin. I have to see, if adding the lines might result in problems when the frei-chat plugin is not installed. If not, I might release an updated version.

    Regarding the login / index page issue: the line

    $login = elgg_view("my_views/account/login_box");

    does only add the login widget to the index page (for example the custom_index home page, if you want to use that in the later line $body = elgg_view_layout('custom_index', $params);).

    The loginrequired_index homepage that I included in this plugin is just a separate index page / frontpage that I included in the plugin as a separate page that only logged-out users can see. Logged-in users still see the separate homepage via custom_index that is populated with more content.

    If you don't want the login widget on your frontpage / homepage I would suggest to remove the lines

    //grab the login form
    $login = elgg_view("core/account/login_box");

    $params = array(
            'login'  => $login
    );

    While $login = elgg_view("engine/start"); might not cause the error after all it surely does nothing that works.

  •  Hello @iionly, well, I was trying what you said, because it sound greats, so I would have a welcome (home) page, and a good bye page, the one in your loginrequired_index. But it doesn't works at all. I delete those lines you point in here before, but it doesn't show my current home page. Just a blank page, only with the header, and the footer.

     In the other hand, what I intend to with the "engine/start", y send Elgg to start again, so it gets to the home page. I's sure there should be a better way to do that...

     The cache folder doesn't exist, but, for some reason, it's include in default allowed pages in engine/classes/ElggSite.php , don't ask to me, lol.

     

    Kind Regards, Hector

     

  • Thanks for this plugin.  very usefull.

Stats

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

Other Projects

View iionly's plugins