I would like to change the ownership of all nodes created by one user to another. Obviously, this could be done manually by the "Edit" tab, but I was curious if anyone had insights about a more automated way to perform this operation. Is a simple UID MySQL statement sufficient, or would the solution be a bit more involved?

Thanks.

Comments

jastraat’s picture

It seems like "UPDATE node SET uid = WHERE uid =
" would work. I'd still back up your database before executing it though *smile.

------------------------------
http://fraggles.artsci.wustl.edu (Drupal user documentation and development blog)

M.J. Taylor’s picture

Simple SQL should work fine.

But, personally, I'd do it in a development environment first. Nothing like messing up one field in a SQL update and having no way to recover...

Off the cuff..

UPDATE `node` SET `uid` = 'newUID' WHERE `uid` = oldUID ;

M.J. Taylor
Publisher
from Reason to Freedom
Wekly libertarian magazine promoting thinking for oneself, thus helping to create a free, benevolent society.

Leech’s picture

Very useful!