View Full Version : How do I assign orphaned photos to another user?
April 8th, 2013, 08:56 PM
We pruned users from our VB instance and one of the users has re-registered and would like their old gallery connected to their new userid.
The old gallery (user=2875) was orphaned during the prune but is accessible here: Gallery - War of the Ring Community Photo Forum (http://www.warofthering.net/photoforum/showgallery.php?sortby=d&sorttime=9999&way=des&thumbsonly=0&perpage=90&page=1&cat=500&ppuser=2875&thumbcheck=0&cat=500)
The user registered with the same name but obviously a new user number has been assigned (8130: View Profile: Amendra - War of the Ring Community (http://www.warofthering.net/forums/member.php?8130-Amendra)
Is this possible?
April 8th, 2013, 10:12 PM
well you can assign a photo to another user as admin by editing and filling in the new users name.
You however want to redo in mass so use phpmyadmin and issue these queries
UPDATE pp_photos SET userid=8130 WHERE userid=2875
UPDATE pp_comments SET userid=8130 WHERE userid=2875
April 9th, 2013, 12:22 AM
Thanks Chuck....that's exactly what I am looking for...
Problem is that I've never ran queries with PHPmyAdmin before....
I looked up some examples and most instructions state to just go to the SQL tab while in the DB and having the table selected...so entered this as my syntax:
UPDATE `photopostphotos` SET `userid`='8130' WHERE 'userid' ='2875';
I've also tried:
UPDATE `photopostphotos` SET `userid`= WHERE `userid`=;
I can run a select on that userid and get results but cannot get any joy with the update. What the heck am I doing wrong? *bangs head*
April 9th, 2013, 07:53 AM
Use what I posted just change the table prefix they are valid.
I do not know where your doing whatever but if your in phpmyadmin viewing the photopost database and hit the sql box and enter the queries I noted then they would be changed.
April 9th, 2013, 08:56 AM
Told you I was banging my head. What a difference a morning can make. :rolleyes:
It helps if one clicks the stoopid "edit" link so that phpmyadmin actually changes the query. That's why it just kept returning the stored search results.....DOH. At least I know how to use the stooped thing now.:cool:
I added one more query which just tidied it all up:
UPDATE photopostphotos SET user='Amendra' WHERE userid=8130
This replaced the null value from the previously deleted user name and all is well.
All better now and thanks for the education.
April 9th, 2013, 09:02 AM
There is a function in admin => scan database that says update username on photos and comments that does that for all users. That is there incase someone changes there username. In alot of forums we integrate with there is that ability so we have a function for that. ;)
The query you ran on photos table could have also looked like this give you a little tutorial on mysql update command. ;)
UPDATE photopostphotos SET user='Amanda',userid=8130 WHERE userid=2875
April 9th, 2013, 09:22 AM
True enough...but I would have still wanted to run the other two so that user actually matches the correct userid so it's all good.
Thanks again for the education. ;)
Oh...and I did try that function from the admin panel before I came here for help but it didn't work and I suspect that's because the userid didn't match what it was looking for. It did find a couple though and fixed those.
Have an excellent day.
April 9th, 2013, 09:42 AM
Right the function in admin just corrects names if they have been changed. Nothing is going to change a userid on a photo unless as admin you edit the actual photo and input a different username to assign that photo to.
There is no mass change all photos of a user to another it is one at a time. ;)
vBulletin® v3.8.1, Copyright ©2000-2014, Jelsoft Enterprises Ltd.