Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
general-topic
Mass reasign posts
Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 9:08 pm

Hi due to the issue with the attacks against the admin account in wordpress I've deleted that account. We'd like to reassign all the posts to another user so a name still shows up. It's hundreds of post. Do you know of anyway to accomplish this?

ie: replace user id with user id 643.

Thanks!

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 9:55 pm

this is quite involved...  the user id is widespread throughout the database...  sfmembers, sftopics, sfposts, sfmemberships, sfmessages, users, user_meta immediately come to mind... but there are several others related to plugins and ones not on the tip of my tongue...

 

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 10:06 pm

I'm just looking to replace it in the post like you would through the toolbox, however it would take hours to do that manually. So I was thinking I just need to replace it in the user_id of the sfposts table. But wasn't sure if I did that, if it would work. I've also not found a way to do an exact match find and replace with phpmyadmin.

 

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:13 pm

that is much, much simpler than moving a user...  you would move the post to a new user, but the user new would not inherit thinks like subscriptions, permissions, memberships, capabilities, etc etc etc...

fair warning, but if all you want to do is reassign a post to another user id, all of one user to another, this should work in phpmyadmin:

UPDATE wp_sfposts SET user_id = xxx where user_id = yyy;

xxx is the new user id and yyy is the old user id...  but again, caution.. you might want to have a db backup before you proceed.. just in case... ;)

and your wp db prefix might not be wp_....

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:17 pm

I have a local environment to test this, so THANK YOU!!! :)

 Shari  

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:25 pm

Looks like it worked. I'm so excited.. I'll make sure to test a few thing just to make sure but that looks to have done the trick.

Thank you Thank you Mr. Papa!!!!

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:27 pm

np. glad to help...

I should add that in the next version after 5.3 (which is just waiting on wp 3.6), we will be working on a way to delete users with more options including reassigning everything to a new user (hopefully!)...

Avatar
Shari Smith
Chicagoland
Member
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:29 pm

Nice! Looking forward to it :)

 Shari  

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2013 - 11:32 pm

just have to see what is realistic! ;)

but we need  more options for deleting a user than just moving posts to being from a guest... but if the user is being deleted, it will probably be a mass reassign like you wanted...  or maybe allow posts to be deleted.. or assigned to guest (like today)... or other...

Avatar
Yellow Swordfish
Glinton, England
SP Master
sp_UserOfflineSmall Offline
May 25, 2013 - 3:06 am

It's worth pointing out that while WordPress does not support changing a users login name through the UI - and it is the login name 'admin' we are talking about here in particular - then actually manually changing that login name in the database 'users' table will work and is effective in removing the target 'admin' from the database.

andy-signature.png
YELLOW
SWORDFISH
Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 619
Members: 17361
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10127
Posts: 79625