Forums / Developer / adding ezAuthor to content object

"Please Note:
  • At the specific request of Ibexa we are changing this projects name to "Exponential" or "Exponential (CMS)" effective as of August, 11th 2025.
  • This project is not associated with the original eZ Publish software or its original developer, eZ Systems or Ibexa".

adding ezAuthor to content object

Author Message

Arnaud Georgin

Wednesday 02 May 2007 7:36:45 am

Hello,

I developped a cron which creates Articles. Everything is ok (title, subtitle, body...) except the author. I want to add author to the created article.
I tried to call the "setAttribute" method on the ezAuthor Attribute of the Article but it failed.

How can I do it ?

Thanks

blog : http://arnaudgeorgin.blogcity.fr/

Atle Pedersen

Friday 04 May 2007 1:35:29 am

What you do is supposed to work:

        $object->setAttribute( 'owner_id', $ownerID );
        $object->store();

Lazaro Ferreira

Monday 07 May 2007 4:30:13 am

Hi Arnaud,

The ezauthor datatype is a composite datatype (its content is actually an object of class eZAuthor

I think you need to create a new eZAuthor object and then set the contentobjectattribute content, before trying to store the attribute

    $author = new eZAuthor( );
    $i = 0;
    foreach ( $authorIDArray as $id )
     {
        $author->addAuthor( $authorIDArray[$i], $authorNameArray[$i], $authorEmailArray[$i] );
        $i++;
     }
     $contentObjectAttribute->setContent( $author );

Lazaro
http://www.mzbusiness.com