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.

Template Questions /

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

Frontend forms - edit record like show record?


Go to End


3 Posts   2651 Views

Avatar
kharmer

Community Member, 8 Posts

12 March 2013 at 3:26am

Hi all,

I'm gradually getting to grips with SilverStripe. Currently building a load of frontend pages for specific admins to add new records to custom DB tables and found the '_show' suffix for showing a single record (i.e. 'record-details/show/23/' where 23 is record ID).

Is there something similar for editing a record in the frontend?

Best regards,
K...

Avatar
yurigoul

Community Member, 203 Posts

17 March 2013 at 3:10am

Edited: 17/03/2013 3:37am

Would like to know that myself, therefor bumped. The most important thing I would like to know is how to let users add pages from the front end.

The only thing I have found is a way to give a group of people access to one page at a time (without sitetree or tools) in the backend with lots of conditional hiding and showing. I will get back to that later.

Avatar
yurigoul

Community Member, 203 Posts

17 March 2013 at 3:33am

Edited: 17/03/2013 3:41am

Basically you want content editors who have no rights and who will not be able to mess things up and who will not be confused by all the options in the backend. So create a content editor login who can only view and edit pages, nothing more.

Then find the following files in /cms and change them.

# CMSMain_Content.ss
Instead of <% include CMSBreadcrumbs %>:

	<% if $CurrentMember.inGroup(2)  %>
		<% include CMSBreadcrumbs %>
	<% else %>
		<a href="/Security/logout">LOGOUT</a>
	<% end_if %>

Last two links:
	<% if $CurrentMember.inGroup(2)  %> ... <% end_if %>

Instead of $Tools:
	<% if $CurrentMember.inGroup(2)  %>

	$Tools

	<% end_if %>

#LeftAndMain.ss

Instead of $Menu:

	<% if $CurrentMember.inGroup(2)  %>
		$Menu
	<% end_if %>

#Add edit this page and logout link to templates of pages that may be edited.

<a href="admin/pages/edit/show/{$ID}" title="edit this page">Edit this page</a><% if CurrentMember %> | <a href="/Security/logout">LOGOUT</a><% end_if %>

These notes are based on the idea that the admin group is group 2. And it was tested with 3.0.2.