Uh-oh. I realize that I have a lot of blog posts entered with the wrong userid. I'd like to restore this, changing the userid for all these nodes. Can I do this in mysql (better yet, is there a command anyone could send me for how to do this? I'm really clueless). Would it be enough to just change the userid field in the nodes or is there somewhere else I have to turn? I really don't want to change the userid on dozens of posts by hand.

Comments

nlindley’s picture

If you don't want any nodes to be owned by the wrong uid, then I think you could just do:

UPDATE node SET uid=correctuid WHERE uid=wronguid;

However, be careful with that because it will change the owner of every node with wronguid. If you have a list of node IDs to change, then you could try:

UPDATE node SET uid=correctuid WHERE nid=nid1 OR nid=nid2 OR ... ;

I couldn't embed em tags in the code tags, so just know that correctuid, wronguid, nid1, nid2, etc. are all numerical values.

Good luck!

Nick

Linuk’s picture

yehhh, as long as you do not care who these nodes belong to :)

kvarnelis’s picture

ok, cool nlindley's response is just what i wanted... but now i'm wary because of the second response.

of course i care who the nodes belong to. they have been posted under the wrong user. this needs to be corrected so that the right user's name is on them (e.g. it's a one person blog and I posted a whole bunch under admin instead of under my own userid).

Linuk’s picture

ok, just find correct user id and change database like UPDATE {TABLE} SET uid = correct uid WHERE uid=previous uid