Wednesday, April 10, 2013

Re: Content moderation in CakePHP


Hi Alex,

I guess you can create a schema similar which Drupal uses. 
It would be something like this:

1. Create two tables: posts and post_revisions.
2. Posts table would store all new data. When a new post is created, it would be stored there. 
3. To edit a lastest post's version, you could simply edit the Post entry.
4. When a moderator approves a Post, you would create a entry in Post Revisions table. You can do this simply using the beforeSave model callback.

This way you can handle separated the moderated and unmoderated entries, without checkin any boolean field.

Best regards,

Vinicius

On Wednesday, April 10, 2013 10:11:05 AM UTC-3, Alex Bovey wrote:
Hello all,

I'm just wondering how best to approach content moderation and wondered whether anyone that has done something similar could offer any advice?

For example, I have Users that have many Posts.  Whenever a Post is added it needs to be approved before being published (easy), but also when a Post is edited the changes will need to be held in moderation before being published.  Whilst awaiting moderation, the previous version of the Post should stay live on the site until the new version is published.

Also if a User edits a Post that is currently awaiting moderation, they should be presented with the latest (unmoderated) version to edit instead of the current live version.

For this scenario Posts do not HABTM Tags, which keeps it simpler.

So far I have thought of two approaches:

1) Have two tables for Posts and ModeratedPosts and a ModeratedPost belongsTo a Post.  A Post only becomes a ModeratedPost when it has been approved.

2) Store both Posts and ModeratedPosts in the same table with a 'moderated' boolean.  I would still need some way of linking records together so that a Post belongsTo a ModeratedPost.

Any thoughts welcome!

Thanks in advance,

Alex

--
Alex Bovey
Web Developer | Alex Bovey Consultancy Ltd
Registered in England & Wales no. 6471391 | VAT no. 934 8959 65
PHP | CakePHP | MySQL | jQuery | HTML5 | CSS3 | Drupal | Wordpress | Hosting

--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments: