Showing old field content until updated content is approved?

4 posts by 2 authors in: Forums > CMS Builder
Last Post: July 1, 2015   (RSS)

By gkornbluth - June 22, 2015

Hi all,

Just thinking.

Has anyone worked out an easy way to show the original content of a database field on a site until updated content for that field has been approved by the section admin (some time later)?

I already send an email to the section admin informing each time there's an update, but it might be a while before the update can be approved..

Don't know, maybe I'm just not thinking clearly today, but if I toggle the hidden check box, after the update, (as I would with entirely new record) the entire record will be hidden until the update is approved, and that's not the result I'm looking for..

Updates are accomplished by a front end form, and I thought of creating a temp field for each changeable field and switching back and forth somehow, but that felt like it would get really complicated, really quickly.

Maybe not though, and I thought I'd throw it out to the experts before I started down a garden path that might lead me over a cliff.

Thanks for looking,

Jerry Kornbluth

The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

By Dave - June 30, 2015

Hi Jerry, 

Would the content be being updated in the CMS or by a front end form?

Typically the way to do it is either using multiple records or multiple field (a duplicate set of fields prefixed with "Pending: ").  Then on click of an approval button copy the values from one set of fields to the other.  

Cheers!

Dave Edis - Senior Developer
interactivetools.com

By Dave - July 1, 2015

Hi Jerry, 

Well it's definitely going to need you to do some custom programming, but what I do what I have a complicated problem is just break it down into steps:

  1. Create CMS section with two fields, city and pending_city
  2. Create a front end form that updates the value of pending_city when you save it
  3. Create another form with a button that copies the pending value to the current value
  4. Expand fields that are needed
  5. Figure out how to make it user specific
  6. Integrate all the code together and ensure it does what you need

Here's some sample code for updating the field: 

$tableName    = "about";
$recordNum    = 1;
$colsToValues = array(
  'city=' => 'pending_city',
);
mysql_update($tableName, $recordNum, null, $colsToValues);

Good luck!

Dave Edis - Senior Developer
interactivetools.com