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
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
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.
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
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
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
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.
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?
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 %>