Welcome, Guest. Please login or register.
Did you miss your activation email?
May 27, 2012, 02:08:25 AM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
155555 Posts in 21715 Topics by 7737 Members
Latest Member: gx-world
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: Login box  (Read 3515 times)
dominic

Offline Offline

Posts: 34



« on: March 06, 2007, 11:51:08 PM »

I probably am missing it in the wiki docs, but what is the include code for the login box?

Dominic
Logged

---------------------------------------------------------------
Business Strategy Articles:
www.businessatwar.c om
dominic

Offline Offline

Posts: 34



« Reply #1 on: March 07, 2007, 12:23:31 AM »

Code:
<?php
if(FRONTEND_LOGIN == 'enabled' AND VISIBILITY != 'private' AND $wb->get_session('USER_ID') == '') {
?>

<form name="login" action="<?php echo LOGIN_URL?>" method="post" class="login_table">
<?php echo $TEXT['USERNAME']; ?>:
<input type="text" name="username" style="text-transform: lowercase;" />
<?php echo $TEXT['PASSWORD']; ?>:
<input type="password" name="password" />
<input type="submit" name="submit" value="<?php echo $TEXT['LOGIN']; ?>" style="margin-top: 3px; text-transform: uppercase;" /><br />
<a href="<?php echo FORGOT_URL?>"><?php echo $TEXT['FORGOT_DETAILS']; ?></a>
<?php if(is_numeric(FRONTEND_SIGNUP)) { ?>
<a href="<?php echo SIGNUP_URL?>"><?php echo $TEXT['SIGNUP']; ?></a>
<?php ?>
</form>
<?php
} elseif(FRONTEND_LOGIN == 'enabled' AND is_numeric($wb->get_session('USER_ID'))) {
?>

<form name="logout" action="<?php echo LOGOUT_URL?>" method="post" class="login_table">
<?php echo $TEXT['LOGGED_IN']; ?>
<br />
<?php echo $wb->get_display_name(); ?>
<br />
<input type="submit" name="submit" value="<?php echo $MENU['LOGOUT']; ?>" />
<br />
<a href="<?php echo PREFERENCES_URL?>"><?php echo $MENU['PREFERENCES']; ?></a>
<br />
<a href="<?php echo ADMIN_URL?>/index.php"><?php echo $TEXT['ADMINISTRATION']; ?></a>
</form>
<?php
}
?>



Found this in one of the templates, does it look right?

Dominic
Logged

---------------------------------------------------------------
Business Strategy Articles:
www.businessatwar.c om
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #2 on: March 07, 2007, 07:52:27 AM »

Indeed the Login has been left out of the basic template tutorial.

In general you can take the code for the login out of any existing template we do have on offer at the add-on repository. You just need to style the output according to your template needs.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

orko3001

Offline Offline

Posts: 110


« Reply #3 on: October 07, 2007, 06:38:12 PM »

Hi, I just want to add a login box onto the main body of one page. Can that be don or done or do i need to build a new template?
Logged

Please assume I have searched for the answer first - because I have.
Vincent

Offline Offline

Posts: 360


WWW
« Reply #4 on: October 08, 2007, 09:01:59 AM »

Hi Orko,

haven't tested, but I suppose it should be possible using the 'code'-section. So what you do is open the page in WB admin and click 'manage sections', add a section 'code' and paste the code there. What you'll get is a login field in the content area, unless of course you've made a section block somewhere else in your page.

The other solution you suggested yourself: make a new template and assign that one to your page.

Regards,
Vincent
Logged
kweitzel
Forum administrator
*****
Offline Offline

Posts: 6977


WWW
« Reply #5 on: October 08, 2007, 01:15:50 PM »

Just make a menu link to the login form ... that will do what you want.

cheers

Klaus
Logged

WebsiteBaker Org e.V. - for WebsiteBaker

orko3001

Offline Offline

Posts: 110


« Reply #6 on: October 09, 2007, 10:01:44 PM »

Quote
Just make a menu link to the login form ... that will do what you want.
cheers
Klaus

That'll log you into the backend. I want people to stay with the frontend. But I only want a login box on one page.

I put the above code into a code box and got this:

Parse error: syntax error, unexpected '<' in /home/site/public_html/modules/code/view.php(30) : eval()'d code on line 4

The code box seems to delete my php tags once saved :s

Cheers
Logged

Please assume I have searched for the answer first - because I have.
Ari Lindholm

Offline Offline

Posts: 31


WWW
« Reply #7 on: October 09, 2007, 10:51:01 PM »

Have you tried to leave <? and ?> marks out from that code (if you want to use paste that code trick)?
< http://forum.websitebaker.org/index.php/topic,3773.0.html#msg23496 >

Other method: Personally i would try to use 2 almost similar templates, one with login code-part in template and other without it. And assign those templates right pages.
This could keep your things much clearer i think...
Logged
gilly

Offline Offline

Posts: 49


« Reply #8 on: March 17, 2008, 06:07:28 AM »

Im having the exact same issue as Orko.

I want my login form to be on its own page, with a simple text link to it on each page. When the user logs in they get to see content in the navigation that they wouldnt see if they werent logged in.

I get the same parse error when I put the login script into the Code box, and I have tried both with and without the php tags at the start and end.

I have tried using the 2 templates method, and although this works, is not at all suitable. If its setup like this, and I need to change the CSS or the layout in one template, means I need to make the change in both templates, repackage them, reupload them both. Doesnt sound like a very efficient solution to me.

Could the code be somehow built into the template, but only be displayed when the user is visiting a certain page (eg on a member-login.php page?

Orko, did you come up with a solution?
Logged
ruebenwurzel
WebsiteBaker Org e.V.

Offline Offline

Posts: 7973



WWW
« Reply #9 on: March 17, 2008, 07:37:20 AM »

Hello,

so why didn't you simply do what you wanna do?

1. Create a "hidden" WYSIWYG Page by using the default template with a login form in it.
2. Place a link to this page in the index.php of your template.

This way, if a user hits the login link a new page is openene with only your login form.

Matthias
Logged
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2298



WWW
« Reply #10 on: March 18, 2008, 12:28:23 AM »

Try this in (the footer) of your template index.php

Code:
<?php if(FRONTEND_LOGIN == 'enabled' AND  $wb->get_session('USER_ID') == '') { ?>
 <a href="<?php echo WB_URL?>/account/login.php" target="_top">Login</a>
<?php } elseif(FRONTEND_LOGIN == 'enabled' AND is_numeric($wb->get_session('USER_ID'))) { ?>
 <a href="<?php echo WB_URL?>/account/logout.php" target="_top">Logout</a>
<?php ?>

I use this on all mysites.

Ruud
Logged

Professional WebsiteBaker Solutions
casi

Offline Offline

Posts: 49


« Reply #11 on: July 05, 2008, 10:34:59 AM »

Hi Ruud

This works great. Do you have an idea how the logged in user could bes displayed with his name (username):

Code:
<?php page_footer(); ?>&copy; 2008 Zischtigs Club Loz&auml;rn | Design by <a href="http://www.casi.ch" target="_blank">casi.ch</a> | <a href="http://start.websitebaker.org/" target="_blank">websitebaker</a> | <?php if(FRONTEND_LOGIN == 'enabled' AND  $wb->get_session('USER_ID') == '') { ?>
 <a href="<?php echo WB_URL?>/account/login.php" target="_top">Login</a>
<?php } elseif(FRONTEND_LOGIN == 'enabled' AND is_numeric($wb->get_session('USER_ID'))) { ?>

Welcome: display Username here | <a href="<?php echo WB_URL?>/account/logout.php" target="_top">Logout</a>

<?php ?>

Thanks Casi
Logged
vyni

Offline Offline

Posts: 566


« Reply #12 on: July 05, 2008, 11:03:44 AM »

Hi there,
it´s easy to change the code from an existing template. For example Round. Have a look there.
I made such modifications in the past - give it a try, copy and past the responding login/logout lines to Your template and that´s it.

And if You don't want the link to the backend at all - just find this lines in index.php
Code:
     <tr>
          <td class="logout"> <a href="<?php echo ADMIN_URL?>"><?php echo $MENU['PREFERENCES']; ?></a>
           </td>
     </tr>
and remove them.

« Last Edit: July 05, 2008, 11:25:06 AM by vyni » Logged

PS: Falls jemand eine Idee hat was zu tun ist und mir das erklären könnt - geh bitte davon aus dass ich ahnungslos bin, was php und so betrifft. Ich kann grad was lesen, kopieren und einfügen,  ungefähr verfolgen und glauben.
Ruud
WebsiteBaker Org e.V.

Offline Offline

Posts: 2298



WWW
« Reply #13 on: July 05, 2008, 11:10:19 AM »

This works great. Do you have an idea how the logged in user could bes displayed with his name (username):

Just add
Code:
<?php echo $wb->get_display_name(); ?>

That's it.

Ruud
Logged

Professional WebsiteBaker Solutions
casi

Offline Offline

Posts: 49


« Reply #14 on: July 05, 2008, 03:46:01 PM »

Fantastic!!! Cheers Ruud
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!