Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

creating a login/out link


Go to End


2 Posts   870 Views

Avatar
wake2010

Community Member, 9 Posts

11 January 2012 at 2:40pm

how do i add a login/out link on the front end of the site?

i would like it so that when a user is not logged in it shows log in and when they are dynamicly says log out

any ideas?

thanks

Avatar
Sticks

Community Member, 31 Posts

11 January 2012 at 4:04pm

Edited: 11/01/2012 4:05pm

In your Page.ss (or other .ss template file) you can use something like this:

<% if CurrentMember %>
    <a href="/Security/logout">Log out</a>
<% else %>
    <a href="/Security/login">Log in</a>
<% end_if %>