Force login at frontpage hack
"Seth Cribby" <[email protected]>
| Newsgroups | gmane.comp.web.envolution.devel |
|---|---|
| Message-ID | <[email protected]> |
At Zoom's request heres the hack to force login at the frontpage:
First of all, this mod/hack was done on PN .714 + encompass .91-1a.
I would recommend testing or trying this out with a fresh install of the combined .714 + .91-1a
a) in admin settings, your start page (index.php points to) must be set to frontpage
b) also, your default theme must be an encompass theme (LogicII), but users may still select non-encompass themes in their own settings
c) finally, your frontpage must include a login block, if it doesnt you'll just be stuck at that page with nowhere to go.
The three above necessities are why I suggest a fresh combined install. The combo package comes with all three of these already properly set.
Backup your files, dont blame me if you dont :)
There are two independant steps:
Step 1)
---------------
With text editor, open yoursite/modules/NS-User/user/access.php
Find: redirect_index(_LOGGINGYOU, $url);
change to: redirect_index(_LOGGINGYOU, $url="index.php?name=News");
With this step, when someone logs in they are sent News page instead of returning to the page where they logged in.
Step 2)
--------------
(i) Open yoursite/header.php
Find (about line 85):
} else {
$thistheme = pnConfigGetVar('Default_Theme');
if (isset ($theme)) {
$thistheme=$theme;
}
}
Change to:
} else {
$thistheme = pnConfigGetVar('Default_Theme');
if (isset ($theme)) {
$thistheme=$theme;
}
pnGetBaseURL();
pnRedirect ('index.php');
}
that is, just add the 2 pn.. fuctions
(ii) Open yoursite\modules\Frontpage\index.php
Find (near the end):
// Display the Frontpage
$index = 3;
include "header.php";
$dts->display('frontpage.tpl');
include "footer.php";
Change to:
// Display the Frontpage
$index = 3;
// include "header.php";
echo "<link rel=\"StyleSheet\" href=\"".$themesarein."themes/" . pnUserGetTheme() . "/style/styleNN.css\" type=\"text/css\" />\n";
echo "<style type=\"text/css\">";
echo "@import url(\"".$themesarein."themes/".pnUserGetTheme()."/style/style.css\"); ";
echo "</style>\n";
$dts->display('frontpage.tpl');
// include "footer.php";
Basically just commenting out header/footer includes and inserting style info found in header.php
What this step does: If someone is not logged, when they try to access a page that includes header.php, they will just be sent to the frontpage.
Just upload the files or whatever, and test it out.