Page 1 of 5

Front-end Users 1.2.5-DEV + solution ;-)

Posted: Mon 29. Aug 2005, 17:30
by ssyfrig
Hello

Does the release 1.2.5-DEV Support Front-end Users? I saw the backend User Administration.

I have Site running Release 1.1-RC4 27-08-2004 and can only upgrade if this function is supported.

Or does any body run a site release 1.2.5-DEV with the mod_ragi_read Mod


Thanks, Sven

Posted: Mon 29. Aug 2005, 17:35
by rushclub
frontend user arent supported in 1.2.5 dev. oliver will release a new version in the next weeks. i think you will see it in the forums when frontend users are supported ;)

cheers
rush

Posted: Mon 29. Aug 2005, 17:39
by d-lexy
hello,

I run 1.2.3 with Ionrock's frontend login mod. I don't see a reason why it would not run with 1.2.5

Posted: Mon 29. Aug 2005, 17:48
by volkman
runs on 1.2.5 here, no problems

volkman

Posted: Tue 30. Aug 2005, 08:21
by dbaron
Same in here :D

Posted: Tue 30. Aug 2005, 15:11
by TAOG
using without hacks would be nice.....

etwas was man nicht erst manipulieren muss ist mir bei solchen system lieber. wenn das update kommt ist das geschreihe wieder groß oder man kann die neuen funktionen nicht nutzen weil alles anders kommt wie man es will ;)

Re: Front-end Users 1.2.5-DEV

Posted: Thu 1. Sep 2005, 14:29
by msdesign
ssyfrig wrote:Hello

Does the release 1.2.5-DEV Support Front-end Users? I saw the backend User Administration.

I have Site running Release 1.1-RC4 27-08-2004 and can only upgrade if this function is supported.

Or does any body run a site release 1.2.5-DEV with the mod_ragi_read Mod


Thanks, Sven
I have done it.

Step1.
Find in index.php the following:
if(!isset($_SESSION['frontend_user'])) {

$_SESSION['frontend_user']['id'] = 0;
$_SESSION['frontend_user']['login'] = 'guest';
$_SESSION['frontend_user']['name'] = 'Guest';

// start frontend user login
if(isset($_POST['fe_user_submit']) || isset($_POST['fe_user_login'])) {

require_once ("include/inc_lib/general.inc.php");
require_once ("include/inc_front/front.func.inc.php");

}

}

and replace it with the following:
if(!isset($_SESSION['frontend_user']) || empty($_SESSION['frontend_user']['id'])) {

$_SESSION['frontend_user']['id'] = 0;
$_SESSION['frontend_user']['login'] = 'guest';
$_SESSION['frontend_user']['name'] = 'Guest';

// start frontend user login
if(isset($_POST['fe_user_submit']) || isset($_POST['fe_user_login'])) {
require_once ("include/inc_lib/general.inc.php");
require_once ("include/inc_front/front.func.inc.php");
$res = login_fe_user($_POST['fe_user_login'],$_POST['fe_user_pass']);
} else {
//Updaten, wenn User ausgewählt
$sql = "UPDATE ".DB_PREPEND."phpwcms_userlog SET logged_in = 0, logged_change = ". time() .
"WHERE logged_in = 1 AND (" . time() ." - logged_change ) > ".$phpwcms["max_time"].";";
mysql_query($sql, $db);
}

}
if(isset($_POST['fe_user_logout'])) {
session_destroy();
unset($_SESSION['frontend_user']);
header("Location:".$phpwcms["site"]);
}

Step 2:
Save the following as phpwcms_template/fe_user_login_form.php
<?php
$fe_login_form = '<form class="login_form" name="fe_login" method="post" action="'.FE_CURRENT_URL.'" style="margin:0;padding:0;"><table class="login_table" border="0" cellspacing="0" cellpadding="1">
<tr class="login_row">
<td style="font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif" class="login_data">Login:&nbsp;</td>
<td class="login_data"><input name="fe_user_login" type="text" id="fe_user_login" size="20" maxlength="30" style="font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;width:130px;"></td>
</tr>
<tr class="login_row">
<td style="font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif" class="login_data">Password:&nbsp;</td>
<td class="login_data"><input name="fe_user_pass" type="password" id="fe_user_login" size="20" maxlength="100" style="font-size:12px;font-family:Verdana, Arial, Helvetica, sans-serif;width:130px;"></td>
</tr>
<tr class="login_row">
<td class="login_data">&nbsp;</td>
<td class="login_data"><input type="submit" name="fe_user_submit" value="Anmelden" style="margin-top:2px;font-size:10px;font-family:Verdana, Arial, Helvetica, sans-serif"></td>
</tr>
</table>
</form>';
?>

Step 3:
Find the following in include/inc_front/content.func.inc.php
// put in the complete rendered content
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);

and replace it with the following:

if(empty($_SESSION['frontend_user']['id']) && $content["struct"][$aktion[0]]['acat_regonly']==1) {
// put in the login form instead of complete content include(PHPWCMS_ROOT."/".$phpwcms["templates"]."/inc_script/fe_user_login_form.php");
$content["all"] = str_replace('{CONTENT}', $fe_login_form, $content["all"]);
} else
{
// put in the complete rendered content
$content["all"] = str_replace('{CONTENT}', $content["main"], $content["all"]);
}

Step 4:
Save the following as phpwcms_template/inc_script/frontend_render/logout.php
<?php
// by Tamer ERDOGAN, 2005 - returns logout submit button
$logout_form = '<form class="logout_form" name="fe_login" method="post" action="'.FE_CURRENT_URL.'" style="margin:0;padding:0;">
<input type="submit" name="fe_user_logout" id="fe_user_logout" value="Abmelden" class="logout_button"></form>';
if( ! ( strpos($content["all"],'{LOGOUT')===false ) ) {
$content["all"] = str_replace("{LOGOUT}", $logout_form, $content["all"]);
}
// LOGOUT replacement (by Tamer ERDOGAN, 2005)
// -------------------------------------------------------------
?>

That is it.
And you can use the {LOGOUT} tag to put the logout button wherever you want in the closed category.

enjoy it.

Posted: Tue 6. Sep 2005, 10:46
by dbaron
I tried but I could have a "login" form to the protected pages.
Did I miss something ?

Thanks

Posted: Tue 6. Sep 2005, 11:41
by frold
can someone confirm that this work?

If so - maybe it should be posted in the hack section ;-)

Posted: Tue 6. Sep 2005, 12:11
by dbaron
I tried, but I couldn't have the login form for protected pages.
And there is a little mistake in the script:
In the file content.func.inc.php, the file fe_user_login_form.php is in ".$phpwcms["templates"]."/inc_script/fe_user_login_form.php" and msdesign said to create it in phpwcms_template/fe_user_login_form.php.

Is it a mistake ?

True

Posted: Wed 7. Sep 2005, 01:46
by hendrik250874
Nope, followed instructions, and can't get it to work.
However, I think it must be something small though...

Posted: Wed 7. Sep 2005, 08:51
by dbaron
msdesign, any idea?

Posted: Wed 7. Sep 2005, 09:37
by TAOG
dbaron wrote:msdesign, any idea?
sry LOL :) one man, one future with FE login :D

i hope that oliver release the offizial FE login in the near future.

Posted: Thu 8. Sep 2005, 09:14
by dbaron
Nobody tried it? :cry:

Posted: Thu 8. Sep 2005, 09:52
by frold
dbaron wrote:Nobody tried it? :cry:
well the code doesnt worked for me...