This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit ezplatform.com

eZ Community » Forums » General » publish object with php
expandshrink

publish object with php

publish object with php

Wednesday 24 September 2003 2:45:55 pm - 6 replies

Hi!
I try to publish an object in an extension (using php).
With
$object->setAttribute( "is_published", "1" );
$object->store();
I can set the object to 'IsPublished', but in the database (table ezcontentobject_tree) the object is still unpublished (contentobject_is_published = 0).
What can I do?

After the publishing an 'wait until date' event should start, but now even the publish doesn't work...

Thanks for your help,
Sebastian

Wednesday 24 September 2003 3:38:20 pm

Hi,

Try the following code:

include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$operationResult = eZOperationHandler::execute( 'content', 'publish', array( 'object_id' => $contentObjectID,
'version' => $contentObjectVersion ) );

wenyue

Thursday 25 September 2003 10:14:21 am

Thanks, seems to work.
But I always have to run the command twice. First time nothing happens, no error.
After reloading the page the object is published.
Any idea why I have to run it twice??
Sebastian

Thursday 25 September 2003 11:16:10 am

It seems like operation is halted by workflow and continued next time you run operation (when you reload). try to disconect workflow from publish trigger and see if it will be published from the first time.
--SP

Thursday 25 September 2003 11:34:37 am

Sorry, even with no trigger connected the object isn't published from the first time.

Any more ideas? Thanks!

Thursday 25 September 2003 1:19:01 pm

Can you dump the $operationResult variable and show me the result? From the first and from the second run...

Thursday 25 September 2003 1:38:22 pm

$operationResult is: array(1) { ["status"]=> int(1) }
First and second time.

expandshrink

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

36 542 Users on board!

Forums menu

Proudly Developed with from