coppermine-gallery.com/forum

Support => Older/other versions => cpg1.3.x Support => Topic started by: Llamaman on September 29, 2004, 06:12:50 PM

Title: Changing the uploader's name possible?
Post by: Llamaman on September 29, 2004, 06:12:50 PM
Ive had a search for this but I cannot find anything:

I am looking for some sort of Mod or way that I can change the uploader's name for images in my gallery. For example, say I uploaded an image for someone who is registered at the gallery, coppermine would display that the image has been uploaded by me underneath the thumbnail of the image. My question is if there is anyway to change the person that coppermine displays as uploaded an image, for example, an option when clicking on "EDIT IMAGE" or something?

Thanks.

Title: Re: Changing the uploader's name possible?
Post by: Nibbler on September 29, 2004, 06:16:43 PM
Only if you edit 'owner_name' and 'owner_id' in the pics table of the datbase.
Title: Re: Changing the uploader's name possible?
Post by: Tranz on September 29, 2004, 06:19:17 PM
Please do a search: change uploader name
Title: Re: Changing the uploader's name possible?
Post by: Llamaman on September 29, 2004, 09:11:46 PM
Nibbler, this would be possible of course but would there be an easier way of doing it, i.e through coppermine itself?

I have done a search for this, as I explained in my first post, though I haven't found any threads that cover the same subject.
Title: Re: Changing the uploader's name possible?
Post by: Nibbler on September 29, 2004, 09:39:47 PM
You could use this mod for future uploads : http://forum.coppermine-gallery.net/index.php?topic=4122.0

Might need tweaking to work with 1.3.2
Title: Re: Changing the uploader's name possible?
Post by: Llamaman on September 30, 2004, 09:57:35 PM
Thanks for showing me this Nibbler.

This mod almost works in 1.3.2, but I cannot seem to do the last code edit. There is nowhere in picmgmt.inc.php where anything similar to this piece of code is present:

            // User ID is not recorded when in admin mode (ie. for batch uploads)
           $user_id = GALLERY_ADMIN_MODE ? 0 : USER_ID;
                       $username=$USER_DATA['user_name'] ;


Here is what you are meant to replace it with:

// User ID is not recorded when in admin mode (ie. for batch uploads)
           If (GALLERY_ADMIN_MODE)
               {
                $username = $upload_as;
                If (defined('UDB_INTEGRATION'))
                       {
                        $result = db_query("SELECT user_id FROM phpbb_users WHERE username = '$username'");
                       } else {
                               $result = db_query("SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '$username'");
                               }
                $record = mysql_fetch_array($result);
                $user_id = $record[0];
               } else {
               $user_name = $USER_DATA['user_name'];
               $user_id = $USER_DATA['user_id'];
               }


Can you suggest where this piece of code could go or where it could be edited? Thanks.

(by the way, thank you very much for the help so far. Much better quality support than the producers of 4images which i was previously using)

Title: Re: Changing the uploader's name possible?
Post by: Nibbler on September 30, 2004, 10:06:09 PM
That section now reads:

    // User ID is now recorded when in admin mode (casper)
    $user_id = USER_ID;
    $username= USER_NAME;
Title: Re: Changing the uploader's name possible?
Post by: Llamaman on October 03, 2004, 07:52:29 PM
Ok i have found that section and tried to make the edit, but it doesnt seem to work unfortunatly. Ive made the edits to "phpbb_users" and changed it to "ibf_members" and changed "username" to just "name" and "user_id" to just "id" (following the structure for that table in IPB)

This is what the edited section of the code looks like:

// User ID is not recorded when in admin mode (ie. for batch uploads)
           If (GALLERY_ADMIN_MODE)
               {
                $username = $upload_as;
                If (defined('UDB_INTEGRATION'))
                       {
                        $result = db_query("SELECT id FROM ibf_members WHERE name = '$username'");
                       } else {
                               $result = db_query("SELECT user_id FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '$username'");
                               }
                $record = mysql_fetch_array($result);
                $user_id = $record[0];
               } else {
               $user_name = $USER_DATA['user_name'];
               $user_id = $USER_DATA['user_id'];
               }
// End of upload as user mod edit
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (pid, aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip) VALUES ('', '$aid', '" . addslashes($filepath) . "', '" . addslashes($filename) . "', '$image_filesize', '$total_filesize', '{$imagesize[0]}', '{$imagesize[1]}', '" . time() . "', '$user_id', '$username','$title', '$caption', '$keywords', '$approved', '$user1', '$user2', '$user3', '$user4', '$raw_ip', '$hdr_ip',$upload_as)";
    $result = db_query($query);

    return $result;
}


Could anyone suggest an alternate way to make this compatible for cpg 1.3.1?
Title: Re: Changing the uploader's name possible?
Post by: xt3rm on October 04, 2004, 12:06:40 PM
Would there be a way to make this work with batch add?  Because you would want that if there was a huge number of photos so that you could up them by ftp.  And allow the user the same access to the file as they would have normally.