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.

General Questions /

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

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

Members Only Page


Go to End


3 Posts   1095 Views

Avatar
arferrari

Community Member, 4 Posts

3 December 2010 at 1:53am

Edited: 03/12/2010 10:12am

I wanna show the main menu (top menu) with a "Enter" link for not logged users, but if the user is a logged user, I wanna replace the "Enter" link title to My Profile.

I found the flowing article about Members Only Page but didn't understood very well how to do this.

http://doc.silverstripe.org/recipes:members-only-page

Can anyone help me?

Avatar
Mo

Community Member, 541 Posts

4 December 2010 at 2:00pm

Hi arferrari,

If you only want to check if the user is logged in, and you are adding the link manually, you should be able to use this in your template:

<% if CurrentMember %><a href="link/to/profile">My Profile</a>
<% else %><a href="link/to/enter">Enter</a><% end_if %>

Hope that helps,

Mo

Avatar
arferrari

Community Member, 4 Posts

4 December 2010 at 4:06pm

Perfect!!!

Thanks a lot!