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

Registration Form


Reply


6 Posts   2036 Views

Avatar
Terminator4

Community Member, 81 Posts

26 January 2009 at 9:54am

Hey Guys,
Just want to find out how I can remove the Registration Form from the menu once a user is logged in and show the Log Out button instead?

Thanks

Avatar
Carbon Crayon

Community Member, 598 Posts

26 January 2009 at 11:21am

Hi Terminator

You could use something like this:

<% if CurrentMember %>

$LogoutButton

<% else %>

$LoginForm

<% end_if %>

Take a look at the forum module as it has something like this implented

Avatar
Terminator4

Community Member, 81 Posts

28 January 2009 at 5:46am

Thanks man... unfortunately this is not really what I am looking for. I am looking for a scenario where I could choose what menu items are only for users logged in and others for the general public. But taking into consideration that the main menu is generated my SS so I cannot really use the option you suggested... can I?

Unfortunately there is no more extensive documentation. If I could just get hold of the SS guys or get them to respond to my mails with my few questions then I would be able to contribute, further, to the current documentation.

Thanks anyways

PS: Any future assistance would be greatly appreciated by me and the rest of the community

Avatar
Hamish

Community Member, 712 Posts

28 January 2009 at 9:07am

Well, Aram answered your 1st question perfectly.

To answer your new, completely difference question - page level access is set in the CMS. Find the page, click on the "Access" tab. From here you can set who can and can't view the page. The pages you want hidden to the public, set as 'Logged-in users only'. It will disappear from the menu for logged out users.

Avatar
Terminator4

Community Member, 81 Posts

28 January 2009 at 9:32am

Okay.... I am still unsure of how to add a logout button to the menu. I guess I would need to create a function and use that as the hack. Yes?

Avatar
chrisdarl

Community Member, 33 Posts

13 June 2009 at 7:32am

Open your menu .ss file

add the following code whereever you want the button to be

<% if CurrentMember %>

$LogoutButton // or code for your logout button

<% end_if %>