[TYPO3] newloginbox - check user state logged in?

Gregory Remington greg at mediatech.net
Mon Oct 22 20:47:51 CEST 2007


Katharina wrote:
> My aim is to display a link to the login page defined in my template 
> file for my typo3 website. The link is named 'login' and if the user
>  is already logged in I would like to have 'log out' displayed instead.

Hi Katharina,

I did something similar using Typoscript and styling the Logout button 
to appear as a text link like this.

<div id="member-links">
<form action="index.php?id=13" target="_top" method="post" 
style="margin: 0pt; white-space: nowrap;">
<b>username &nbsp; <input type="submit" name="submit" id="logout" 
value="Logout" /></b>
<input type="hidden" name="logintype" value="log out" />
<input type="hidden" name="pid" value="4" />
</form>
</div>

/************************/
/* CSS for member-links */
/************************/

#member-links input {
color:#eb3d12;
background-color:#fff;
border: 0px solid #fff;
padding:0;margin:0;
}

#member-links input:hover {
background-color:#fff;
color:#ff8700;
}


Here's my setup.

# Sign In user
#######################################
page.1{
subparts.MEMBER-LINKS = TEXT
subparts.MEMBER-LINKS.insertData = 1
subparts.MEMBER-LINKS.value (
<b>Members:</b> <a href="index.php?id=5">login</a>
)
}

# Sign Off user
#######################################
[loginUser = *]
page.1 {
subparts.MEMBER-LINKS.value (
<form action="index.php?id=13" target="_top" method="post" 
style="margin: 0pt; white-space: nowrap;">
<b><!--###USERNAME###-->&nbsp; <input type="submit" name="submit" 
id="logout" value="Logout"  /></b>
<input type="hidden" name="logintype" value="log out" />
<input type="hidden" name="pid" value="4" />
</form>
)
}
[GLOBAL]

Cheers,
Gregory

---
Mediatech Consulting
web: http://www.mediatech.net . Skype: gremington



More information about the TYPO3-english mailing list