5317 Posts in 1593 Topics by 1165 members
|Go to End|
14 January 2010 at 6:37pm
I am using the DataObjectManager with Actions which looks after a particular page type. The action ive placed on each item is to either publish the page if its not published or unpublish it if its published. The code thats gets invoked when trying to do this from the action is seen below
public function handleStatus( $request )
$SQL_id = Convert::raw2sql($request->param( "ID" ) );
$page = DataObject::get_by_id("SiteTree", $SQL_id);
if($page && !$page->canPublish()) return Security::permissionFailure($this);
if ( "Published" == $page->Status ) $page->doUnpublish();
Currently only the SiteTree tables status is updated from what Ive seen and when going to this page the "Cancel draft changes" button appears, as well as the page still being Published (on the live stage). What do I need to add to make sure this code does what its meant to do ?
20 January 2010 at 8:56am
Still cannot figure this issue out.
|Go to Top|