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.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

How To Use SilverStripe For Company Intranet ??


Reply

5 Posts   1564 Views

Avatar
AJIT

10 April 2010 at 7:21pm Community Member, 4 Posts

We have selected SilverStripe For Our Company Employee Intranet
We want that the site has to be secured and therefore I have added following in Page Class after studying security documents on web

parent::init();
       if($this->URLSegment != 'Security' && !Permission::check("VIEW_SITE"))
Security::permissionFailure(null);

This code works but there is no logout link on page

How to get log out link on page (just like admin user) for all logged in users ?

Regards ,

AJIT

Avatar
AJIT

10 April 2010 at 7:25pm Community Member, 4 Posts

We are implimenting version 2.4.2 RC2

Avatar
Willr

11 April 2010 at 11:54am (Last edited: 11 April 2010 11:55am), Forum Moderator, 5511 Posts

How to get log out link on page (just like admin user) for all logged in users ?

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

That code basically says If logged in, add a link tag to logout. (Security/logout is the logout handler).

Avatar
AJIT

11 April 2010 at 1:09pm Community Member, 4 Posts

I have done this but how to make following line work in footer template ?

    <% _t('LOGGEDINAS','Logged in as') %> <strong><% if FirstName && Surname %>$FirstName $Surname<% else_if FirstName %>$FirstName<% else %>$Email<% end_if %></strong>

How to make Firstname & Lastname available when any user logs in ?

Regards

AJIT

Avatar
Willr

11 April 2010 at 2:03pm Forum Moderator, 5511 Posts

Well if they are logged in then you have the $CurrentMember Object. So you can call any member functions on like like $CurrentMember.FirstName $CurrentMember.Email or just wrap your code in a <% control CurrentMember %>