Share » Forums » Developer » Code will create drafts, but not...

Code will create drafts, but not publish them

Code will create drafts, but not publish them

Sunday 30 January 2005 8:17:38 am - 2 replies

Modified on Sunday 30 January 2005 8:18:35 am by Gabriel Ambuehl

Author Message

Sven Berg Ryen

Sunday 30 January 2005 10:37:43 am

Hi Gabriel!

I haven't ever tried manually setting the "published" and so attributes, so I can't comment on your code.

I think it would be easier if you, after storing the objectInstance, published it:

    $operationResult = eZOperationHandler::execute( 'content', 'publish', array( 
       'object_id' => $newObjectInstance->attribute( 'id' ), 'version' => 1 ) );

If I were you, I'd take a look at the file /cronjobs/rssimport.php.
In that file, you'll see one of the ways of adding objects to ez by code.

You may also need to create a version 1 of the object:

    $version =& $contentObject->version( 1 );
    $version->setAttribute( 'status', EZ_VERSION_STATUS_DRAFT );
    $version->store();

HTH, and have a nice day! :)

Cheers,

Sven Ryen
sven.ryen at maxus.no

Gabriel Ambuehl

Sunday 30 January 2005 11:41:05 am

Seems like that did the job... Many thanks!

Visit http://triligon.org

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu