CmsContentManagerUtils from frontend plugin

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
User avatar
rotezecke
Power Poster
Power Poster
Posts: 393
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

CmsContentManagerUtils from frontend plugin

Post by rotezecke »

I am working on a plugin (used in a content page, with limited access by a MAMS group) that is supposed to create a content page on the fly.

Code: Select all

$contentops = cmsms()->GetContentOperations();

//this line does not work:
$pagedefaults = CmsContentManagerUtils::get_pagedefaults();

$content_obj = $contentops->CreateNewContent('content');
$content_obj->SetOwner(1);
$content_obj->SetLastModifiedBy(1);
$content_obj->SetActive($pagedefaults['active']);
$content_obj->SetSecure($pagedefaults['secure']);
//and so on
        ...
//then
$error = $content_obj->ValidateData();
if(!$error)
{
  $content_obj->Save();
}		
I cannot load the pagedefaults by following the examples from some admin pages. that does not seem to work from frontend tag. Could someone point me in the right direction? Thanks
User avatar
rotezecke
Power Poster
Power Poster
Posts: 393
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: CmsContentManagerUtils from frontend plugin

Post by rotezecke »

still dont know how to call CmsContentManagerUtils but this works:

Code: Select all

$cntMgr = \cms_utils::get_module('CMSContentManager');
$tmp = $cntMgr->GetPreference('page_prefs');
if( $tmp ) $pagedefaults = unserialize($tmp);
User avatar
velden
Dev Team Member
Dev Team Member
Posts: 3348
Joined: Mon Nov 28, 2011 9:29 am
Location: The Netherlands

Re: CmsContentManagerUtils from frontend plugin

Post by velden »

If you'd added that one line in your UDT it would have worked too:

Code: Select all

$contentops = cmsms()->GetContentOperations();

//this line does not work:
\cms_utils::get_module('CMSContentManager');
$pagedefaults = CmsContentManagerUtils::get_pagedefaults();
User avatar
rotezecke
Power Poster
Power Poster
Posts: 393
Joined: Fri Apr 18, 2008 9:34 pm
Location: Nimbin, Australia

Re: CmsContentManagerUtils from frontend plugin

Post by rotezecke »

Thank you.
Post Reply

Return to “Developers Discussion”