Topic: Login Box and Recognition

Okay, I have a site that I have added a login box to the top of each page, on the forum template and on the regular pages in my site.  I would like to figure out a way to have the login box only appear when someone isn't logged in, and when someone is logged in I'd like the box to be hidden and a welcome message like "Hello, [username], welcome to the forums!"

I am not fluent in PHP, however I do well editing things and working out problems.  If anyone could help me with the code I'd have to use, please do.  Thank you smile!


...Andy...

2

Re: Login Box and Recognition

If you open up header.php, you can see how the page is displayed based on whether a user is logged in or out:

    // START SUBST - <pun_status>
if ($pun_user['is_guest'])
    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
else
{
    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';

You can alter that and add your login forms.

Re: Login Box and Recognition

I did something like this for my new site

http://punbb.org/forums/viewtopic.php?id=4932

new site.

http://www.themoviesbacklot.com

As you can see the login box is at the top but changes after you login.

Re: Login Box and Recognition

Elzar wrote:

If you open up header.php, you can see how the page is displayed based on whether a user is logged in or out:

    // START SUBST - <pun_status>
if ($pun_user['is_guest'])
    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<p>'.$lang_common['Not logged in'].'</p>'."\n\t\t".'</div>';
else
{
    $tpl_temp = '<div id="brdwelcome" class="inbox">'."\n\t\t\t".'<ul class="conl">'."\n\t\t\t\t".'<li>'.$lang_common['Logged in as'].' <strong>'.pun_htmlspecialchars($pun_user['username']).'</strong></li>'."\n\t\t\t\t".'<li>'.$lang_common['Last visit'].': '.format_time($pun_user['last_visit']).'</li>';

You can alter that and add your login forms.

Would I have to call up the header.php file or "include" it?  Could someone help me with how to do that  roll?

Re: Login Box and Recognition

No I think you have to include common.php:
http://punbb.org/docs/dev.html#integration

http://preferans.de/ - russian card game