Search

something like

'page' => '/publish/new/',
'delegate' => 'EntryPreCreate',
'callback' => 'forceAuthorId'

public function forceAuthorId($data)
{
    $data['entry']->set('author_id', '555555');
}

can someone help me?

Hmm it looks like the author_id is set when setDataFromPost() is called on an Entry object (which in turn calls assignEntryId). This occurs before the EntryPreCreate delegate is fired. Once the author_id is set from the assignEntryId it is never updated again.

The alternative is to update using SQL within your callback function:

public function forceAuthorId($data) {
    Symphony::Database()->query(sprintf(
        "UPDATE sym_entries SET author_id='%d' WHERE entry_id='%d'",
        555555, $data['entry']->get('entry_id')
    ));
}

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details