Changing the ownership after batch upload Changing the ownership after batch upload
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Changing the ownership after batch upload

Started by tom123, November 28, 2006, 12:10:02 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

tom123

I have tried finding information on this issue, but all I came across is posts about not being able to upload. I am able to upload via the batch process just fine. I would, however, like to change the ownership/control of images (uploaded via a batch upload) back to the original owner instead of the admin. How can I do turn control back to the user just as if they uploaded the images themselves?

Joachim Müller

You can't change ownership in Coppermine, there's no control built into the Coppermine user interface. You'll have to manually edit your database table "yourPrefix_pictures", using a tool like phpMyAdmin.

tom123

I was hoping there would be something in admin to do this, nonetheless I would like to change it. Since I don't know much about php, could someone please tell me what I would have to change in the table yourPrefix_pictures to give control of the batch uploaded images back to the user? I searched the forum for information on this table but nothing other than this post and something about a language change showed up.

Joachim Müller

owner_id and owner_name. Should be pretty self-explanatory. No PHP skills needed. Backup before you try, or don't try at all.

lamama

You'll need some experience with phpMyAdmin and MySQL databases.

phpMyadmin (or a simliar tool) should been available on your webserver or your webhost's admin interface.

Find it, start it and get familiar with it.

As GauGau said: The database table is something like
cpgXXX_pictures  (the prefix may be different, '_pictures' is the important part)

Let phpMyAdmin display you that table. There is a button "Browse" above the datafield definitions. Click it and browse the database a bit.

Throw a look on the table columns "owner_id" and "owner_name".
You'll have to update both.

You'll need something like this - modify it to your needs and put in the SQL quiery window of your database:

UPDATE `cpgXXX_pictures`
SET `owner_name`='YOUR-NAME-HERE', owner_id=2
WHERE `owner_id`=3;


Result: all pics of owner #3 will become pics of owner #2 and the owner name is set too (change the name to the real CPG login name of owner #2)

More info about the SQL Syntax: http://dev.mysql.com/doc/refman/5.0/en/update.html

WARNING: if you're not careful you can destroy your database.
a) Backup your database before changing anything (and be sure you're able to restore it)
b) if you're the "no risk no fun" type of guy, just go on - you have been warned.  :)


tom123

Thank you. That is the type of information I was looking for in changing it. I will definitely make sure to back up the database before I attempt anything as I am updating to the latest version as well.

Sy

Sorry for bumping an old post, and for something that people have probably already figured out themselves.

But as I've just resolved this issue myself I thought I'd tack my reply on.

If your ftp uploading for other users into their own directory, so for example your uploading for a user called Fred into '/gallery/albums/fred/', you cal use the following SQL query to change the owner of all the items uploaded to that directory.

UPDATE `cpg148_pictures`
SET `owner_name`='Fred', owner_id=2
WHERE `filepath`='fred/';


Obviously you will need to change the owner_name, owner_id and filepath to suit your needs but it made the job a lot quicker for me.

Hope this helps some other CPG n00bs like myself.

Sy

MatthewSchenker

GauGau, lamama, and Sy,
Thank you for this!  I was also looking for a way to re-assign ownership of photos, but I'm not that good with mysql databases.  This discussion got me on the right track!

This is a great function to know about.

Thanks again!