17488 Posts in 4473 Topics by 1978 members
| Go to End | Next > | |
| Author | Topic: | 3142 Views |
-
Adding "You're logged in as" to a page

13 April 2008 at 1:11pm Last edited: 13 April 2008 1:13pm
Hi,
I am putting together a site which has a members section,
and I want to be able to include a section in the top of the page with:
Login | "You're Logged in as" | Logout | Change password
much like the top right corner of these forums.
So is there a chunk of code, or recipe, or example
that I can use in a template in order to get this
... or even what variables I might be looking for?
//BWS -
Re: Adding "You're logged in as" to a page

14 April 2008 at 6:52pm
you can use CurrentMember I think. So you can do things like
<% if CurrentMember %>
...
<% end_if %>and Hello $CurrentMember.FirstName
Explained rather shortly on http://doc.silverstripe.com/doku.php?id=built-in-page-controls&s=currentmember
-
Re: Adding "You're logged in as" to a page

17 April 2008 at 8:23pm
Mmmm Terse may be a better word.
I take it that documentation is still a nice to have fo rSilverstripe.
Considering this is active in the corner of the CMS, I would have thought this kind of thing would be available.
Is there any plan for a User Manual/User Guide beyond the (frequently) cryptic wiki?
//BWS -
Re: Adding "You're logged in as" to a page

17 April 2008 at 10:42pm
hey bruce, we're currently looking for book authors: http://silverstripe.com/help-write-SilverStripe-book/
-
Re: Adding "You're logged in as" to a page

17 April 2008 at 10:49pm
Everyone would love more documentation. We do try and write as much as we can but the time we can spend on this on top of everything else the guys have going on, somethings always going to give.
We are trying to make an effort in this area and I in particular am very keen to help out as much as possible but we do rely alot on the community to help out with documentation.
If you have suggestions where the documentation is too brief feel free to add it to http://doc.silverstripe.com/doku.php?id=documentation-requests. On that site you can submit ideas and see open requests that you can complete. If you make a request on that page it would be great as then we can see where people are getting lost/confused
-
Re: Adding "You're logged in as" to a page

19 April 2008 at 6:13pm Last edited: 19 April 2008 6:16pm
Okay,
I've constructed<% if CurrentMember %>
<p>Logged in as: $CurrentMember.FirstName </p>
<% else %>
<p> Not logged in </p>
<% end_if %>
at the top of the page & it is working fine when the page requires authentication,
but as soon as you move to (say) the home page
which doesn't require authentication, "Not logged in" appears!
Is the a session-based parameter around this?
$CurrentMember seems to be true only if authentication has been invoked?
//BWS -
Re: Adding "You're logged in as" to a page

19 April 2008 at 6:19pm
Nooo.
Looks like an ugly caching problem,
Grrrrrrr
//BWS -
Re: Adding "You're logged in as" to a page

21 April 2008 at 1:06pm
Try putting HTTP::set_cache_age(0) into your _config.php.
I think we should make that the default for 2.3...
| 3142 Views | ||
| Go to Top | Next > |




