I have added code in a node presave hook before cloning a node as below to change it to the current user id


and then I check with $entity->getRevisionAuthor and it has been changed in that presave function, however upon saving the author reverts back to the author of the original node that was cloned.

What is happening ? thanks

1 Answer 1


I added $entity->setOwnerId($current_user) and that worked

Not the answer you're looking for? Browse other questions tagged or ask your own question.