Login box

casi

Fantastic!!! Cheers Ruud

Ruud

Quote from: casi on July 05, 2008, 11:34:59 AM
This works great. Do you have an idea how the logged in user could bes displayed with his name (username):

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

That's it.

Ruud
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

vyni

#13
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

     <tr>
          <td class="logout"> <a href="<?php echo ADMIN_URL?>"><?php echo $MENU['PREFERENCES']; ?></a>
           </td>
     </tr>

and remove them.



[gelöscht durch Administrator]

casi

Hi Ruud

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

<?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

Ruud

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

<?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
[url=https://dev4me.com/modules-snippets/]Dev4me - WebsiteBaker modules[/url] - [url=https://wbhelp.org/]WBhelp.org[/url]

ruebenwurzel

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

gilly

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?

Ari Lindholm

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...

orko3001

QuoteJust 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

kweitzel

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

cheers

Klaus

Vincent

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

orko3001

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?

kweitzel

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

dominic


<?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

dominic

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

Dominic