Search

I have a section with a checkbox field called is_moderated.

This field is only used by moderators through the Symphony admin interface. It’s not included on the website’s form, which posts to an event.

If I was feeling cheeky, I could craft a form which set is_moderated to ‘1’ from the website form.

<input type="hidden" name="fields[is-moderated]" value="1" />

In Rails, I can set the attribute as ‘protected’ to prevent the field being updated through mass assignment. Can I achieve something similar with Symphony?

Can I achieve something similar with Symphony?

Not in Symphony 2. This functionality is coming in S3 though (one day). One saving grace is that a user would have to know the name of the field to set.

I usually customise my Event to force the $_POST variable. In the generated event __trigger or load method (in the event PHP file) add:

$_POST['fields']['is-moderated'] = 'your-default-value';

Then set allowEditorToParse to false to prevent you re-saving the event through the Symphony UI thereby saving over this customisation.

Thanks Nick. That’s done the trick.

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details