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

Get help with installation and running phpwcms here. Please do not post bug reports or feature requests here.
ssyfrig
Posts: 364
Joined: Tue 2. Mar 2004, 17:01
Location: Zürich / Switzerland
Contact:

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

Post 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
rushclub
Posts: 915
Joined: Tue 17. Feb 2004, 18:52

Post 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
3 (!) Jahre warten reichen mir. Ich bin erst mal weg.
d-lexy
Posts: 76
Joined: Fri 22. Oct 2004, 22:59
Location: Toronto, Canada / Tallinn, Estonia

Post 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
volkman
Posts: 179
Joined: Wed 13. Jul 2005, 12:52
Location: Hamburg, Germany

Post by volkman »

runs on 1.2.5 here, no problems

volkman
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

Same in here :D
TAOG
Posts: 206
Joined: Fri 17. Sep 2004, 20:14
Location: Berlin/Germany
Contact:

Post 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 ;)
msdesign
Posts: 6
Joined: Wed 5. Jan 2005, 10:57

Re: Front-end Users 1.2.5-DEV

Post 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.
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

I tried but I could have a "login" form to the protected pages.
Did I miss something ?

Thanks
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

can someone confirm that this work?

If so - maybe it should be posted in the hack section ;-)
http://www.studmed.dk Portal for doctors and medical students in Denmark
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post 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 ?
hendrik250874
Posts: 32
Joined: Mon 16. Feb 2004, 13:10
Location: Belgium
Contact:

True

Post by hendrik250874 »

Nope, followed instructions, and can't get it to work.
However, I think it must be something small though...
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

msdesign, any idea?
TAOG
Posts: 206
Joined: Fri 17. Sep 2004, 20:14
Location: Berlin/Germany
Contact:

Post 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.
User avatar
dbaron
Posts: 74
Joined: Tue 25. Jan 2005, 11:53
Location: France

Post by dbaron »

Nobody tried it? :cry:
frold
Posts: 2151
Joined: Tue 25. Nov 2003, 22:42

Post by frold »

dbaron wrote:Nobody tried it? :cry:
well the code doesnt worked for me...
http://www.studmed.dk Portal for doctors and medical students in Denmark
Post Reply