Custom index page

We are looking to add a custom index page, essentially a page with some basic info, with 2 button/links, One to register (which is working fine) and then the other to the default login page. The problem is that the login one is not working, it does not load, it acts as if it just refreshes the page. Any assistance with this please (without creating new themes or mods)?
The buttons/links are simple html <a href="mysite.net/register"&gt; and mysite.net/index.php, it is the index.php that refuses to load from this "intro.php" page we created.

  • Thanks Matt. The issue there is most of the plugins and themes are for 1.8 or older, and none of the 1.9 compatible plugins allow us to keep the same layout and only alter the single default page without completely altering the entire site or breaking compatibility with other plugins. This is why we wrote our own index.php instead of using a plugin or theme.

  • Try:

    if (elgg_is_logged_in()) {
        header("Location: activity");
    }

  • You can output any arbitrary html you like, you are not risking changing the entire site.  Look at how the front page plugin handles generating the front page.  When you get to the point where it's

    echo elgg_view_page($title, $body);

    the elgg_view_page() function is what wraps it all in the same layout as the rest of the site.  Instead of that you can echo anything you want, including the straight html that you currently have.

  • It just hit me, you're getting this error:

    Fatal error: Call to undefined function elgg_is_logged_in()

    ​Because intro.php isn't being called by Elgg's API. You either need to use elgg_view(), elgg_extend_view(), or add the code to an overridden view in your plugin where appropriate. Another way is to include engine/start.php in intro.php

  • @Matt that is part of the issue, we do not want this landing index page to be the same format as the rest of the site. It is walled garden requiring login to view anything, so we have it setup where index.php has 2 links: Register and Login (which are the normal elgg pages). This landing page does not have any elgg code in it, and the code suggested and used so far has not worked, only results in errors since elgg is not loaded yet. We wouldn't mind working within elgg to have the same layout but so far everything we see shows elgg has 2 modes, walled garden with login page, or public site. I have not found any way within elgg to have an independent index landing page that can then be linked going to either the register or login page. Elgg does not like an alternate index page.


     

  • I'm really confused on how your site is set up, did you modify the index.php that came with Elgg?

  • Sorry, "intro.php" or "intro.html" that has 2 links:
    1st going to mysite.net/login
    2nd going to mysite.net/register

     

    It is the default "index" or as we called it intro.php, it is ahead of the elgg system, but because of that it is causing these issues with the elgg not liking another page as the default instead of its own. That is where the problems lie, elgg does not have a way to have the "intro" landing page as default, which then refers to the login or register page on its own instead of relying on elgg's own index.php

  • Why don't you just download my landing page plugin, Landr, and modify landr.php to just show a login and register button?

    https://community.elgg.org/plugins/1995172

  • This is the problem:

    I have not found any way within elgg to have an independent index landing page that can then be linked going to either the register or login page. Elgg does not like an alternate index page.

    The good news is that this is completely false, you can have any alternate index page you want, Elgg itself doesn't care.  It provides some default behavior, which you want to override, but it certainly doesn't force anything.  Have you looked at the front page plugin?

  • I see a lot of different plugins relating to the index or default behaviors, but the problem is many remove the walled garden (which we want to keep), some only change the default activity page which we do not want, and others are nothing more than a theme that changes everything which we do not want, so we really have not found anything that will allow us to do what we're looking for (outside of direct modification of the login page which we would prefer to avoid to keep from breaking any plugins or other setups in elgg).
    This is why we want the landing page as default, then link to the login and register pages. Have not found a way to allow elgg to separate them, or provide the info, or move the register link to a much larger easier to see button.

    The other issue is going from the admin section, and clicking "View site" at upper right ends up taking us right back to our landing page instead of the activity page. All these little things that do not work properly because there is no easy way to modify the login page without completely recreating or massively modifying a plugin or theme that ends up changing other aspects of the site.