C5 Issue With Automatic Publishing/ Blog Posting
PermalinkThis is a problem if your posts are being automatically indexed - as the new empty post will come up at the top of your page for all to see!
Now I know the correct way to safely add a page is to go directly to the main blog index page and add it from there. However, for clients who are not all too aware, they are likely to publish an empty page via this method!
Any ideas how to lock this off or make all initial file versions "pending approval" by default?
So based uponhttp://www.concrete5.org/documentation/developers/system/events... what needs to be done:
Add
define('ENABLE_APPLICATION_EVENTS', true);
Create site_events.php in config folder and add
$event = 'on_page_add'; $class = 'requireApproval'; $method = 'pageAddApproval'; $filename = 'modules/auto_disapprove.php'; Events::extend($event, $class, $method, $filename);
So for the new class extension which I assume will look something like this:
class requireApproval extends Controller { function pageAddApproval() { ... } }
I had a look athttp://www.concrete5.org/documentation/developers/permissions/conte... to set the new page in question to disapprove but didn't see a function.
Is there anything in the API for set page permissions -> disapprove() or would I go via mySQL query?
<?php defined('C5_EXECUTE') or die("Access Denied."); class requireApproval extends Controller { function pageAddApproval() { $c = Page::getCurrentPage(); $newcID = $c->getCollectionID(); $q = "UPDATE CollectionVersions SET cvIsApproved = 0 WHERE cID = $newcID"; mysql_query($q); } } ?>
However, how do you get the new page's cID for the query? - $newcID
I.e. Adding a site event will not prevent a page from being automatically published on_page_add!!
There seems to be something overriding it once the dashboard form is submitted. I'm currently having another look at this.
Starting with: tools/edit_collection_popup.php
If anyone has any ideas it would be much appreciated!!
The $$ may very well be worth your time. That is why I made it.
C
The C5 glitch adding pages through sitemap is just a bit of a concern. Does your addon prevent that from happening only via the pro-blog tab or also via the sitemap tab?
regarding blogs...problog would make it so you don't even need the site map visible all together for users whereas this is a concern.
you manage everything from the blog tab.
C
Instead I've gone the unrecommended way and edited out the "Add Page" functionality directly from js/ccm.sitemap.js on line 79. - (Forces the user to do it the safe way - inpage editing directly on the site)
Again, it's not preferred since it removes functionality - but its safer for the client. (Akin to setting permissions)
QUESTION:
1. Is there a way to modify this via a controller to be "pending approval" by default?