forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Uploading => Topic started by: mumtaz on January 12, 2006, 11:14:12 pm

Title: Admin upload pics to user's galery
Post by: mumtaz on January 12, 2006, 11:14:12 pm
How can I create an album in a registered user's gallery, and how can I upload pictures there?
Is there any way, that as an admin I edit the php, so any user's personal gallery I can create albums and upload files there, like as it would be my gallery.
Title: Re: Admin upload pics to user's galery
Post by: Joachim Müller on January 13, 2006, 07:01:45 am
that would defeat the point of a personal gallery,don't you think?
Title: Re: Admin upload pics to user's galery
Post by: mumtaz on January 13, 2006, 11:20:32 am
that would defeat the point of a personal gallery,don't you think?

Ok, ok. This is a private gallery site, where a small group of people show each other pictures, but the problem is, some of them don't know how to create album's on personal galery and how to upload them.
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on January 13, 2006, 12:15:11 pm
Ok if you wish to upload to user's personal gallery here is a small mod for it. This will allow you to create an album for user as well.

Edit albmgr.php

ADD

Code: [Select]
    $query = "SELECT user_id, user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id > 1";
    $result1 = cpg_db_query($query);
    $rowset1 = cpg_db_fetch_rowset($result1);
    foreach ($rowset1 as $row1) {
      $CAT_LIST[] = array(FIRST_USER_CAT + $row1['user_id'], '*'.$row1['user_name'].'*');
    }

just after (somewhere around line 365)

Code: [Select]
    $CAT_LIST[] = array(0, $lang_albmgr_php['no_category']);
    alb_get_subcat_data(0, '');

then edit upload.php

Replace(Around line 850)

Code: [Select]
if (USER_ID) {
    $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");

with

Code: [Select]
if (USER_ID) {
    if (GALLERY_ADMIN_MODE) {
      $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category>'" . FIRST_USER_CAT . "' ORDER BY title");
    } else {
      $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");
    }

HTH

Abbas
Title: Re: Admin upload pics to user's galery
Post by: mumtaz on January 13, 2006, 06:45:43 pm
Ok if you wish to upload to user's personal gallery here is a small mod for it. This will allow you to create an album for user as well.

Edit albmgr.php

ADD

Code: [Select]
    $query = "SELECT user_id, user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id > 1";
    $result1 = cpg_db_query($query);
    $rowset1 = cpg_db_fetch_rowset($result1);
    foreach ($rowset1 as $row1) {
      $CAT_LIST[] = array(FIRST_USER_CAT + $row1['user_id'], '*'.$row1['user_name'].'*');
    }

just after (somewhere around line 365)

Code: [Select]
    $CAT_LIST[] = array(0, $lang_albmgr_php['no_category']);
    alb_get_subcat_data(0, '');

then edit upload.php

Replace(Around line 850)

Code: [Select]
if (USER_ID) {
    $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");

with

Code: [Select]
if (USER_ID) {
    if (GALLERY_ADMIN_MODE) {
      $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category>'" . FIRST_USER_CAT . "' ORDER BY title");
    } else {
      $user_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category='" . (FIRST_USER_CAT + USER_ID) . "' ORDER BY title");
    }

HTH

Abbas

Ohhh. Very thx. (https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fforum.hwsw.hu%2Fhtml%2Femoticons%2Fico_respect.gif&hash=01250004b4f9ebced3871e95ff098a7bca4f60fa)
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on January 13, 2006, 07:33:40 pm
You are welcome mumtaz (is someone making Taj Mahal for you... just kidding).

For those admins who just want to create albums for their users but don't want to upload photos then only edit albmgr.php and similarly if you only want to upload to user's personal gallery then only edit upload.php in the above mod.
Title: Re: Admin upload pics to user's galery
Post by: serge on May 13, 2006, 12:57:31 pm
works this with bridged cpg to smf
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on May 13, 2006, 02:18:06 pm
Are you asking a question whether this works with bridged cpg or not? Or are you telling us that this works with cpg?
Title: Re: Admin upload pics to user's galery
Post by: Kyyhky on May 20, 2006, 12:20:58 pm
Hi,

I did the required changes to those files, and it does work. But...
I'm using bridge to phpbb so I'm using phpbb's user table. Now I can only create albums to users from coppermine's user table. This is of course very logical..

Is there anyway to make a query that would check the user table from phpbb?  :-[ ???
Or should I someway (using phpmyadmin) copy phpbb user tabe into copperminen user table (thou then user id number's should also be identical...)

help, please?  :)
Title: Re: Admin upload pics to user's galery
Post by: Nibbler on May 20, 2006, 02:57:29 pm
Change

Code: [Select]
$query = "SELECT user_id, user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_id > 1";
to

Code: [Select]
$query = "SELECT {$cpg_udb->field['user_id']} AS user_id, {$cpg_udb->field['username']} AS user_name FROM {$cpg_udb->usertable}  WHERE {$cpg_udb->field['user_id']} > 1";
Title: Re: Admin upload pics to user's galery
Post by: Kyyhky on May 20, 2006, 03:56:40 pm
"There was an error while processing a database query.

While executing query "SELECT user_id AS user_id, username AS user_name FROM `kyyhky_phpb1`.phpbb_users  WHERE user_id > 1" on 0

mySQL error:


File: /home/kyyhky/public_html/galleria/include/functions.inc.php - Line: 249"

 ???

Title: Re: Admin upload pics to user's galery
Post by: Nibbler on May 20, 2006, 04:07:07 pm
Also

Code: [Select]
$result1 = cpg_db_query($query);
to

Code: [Select]
$result1 = cpg_db_query($query, $cpg_udb->link_id);
Title: Re: Admin upload pics to user's galery
Post by: Kyyhky on May 20, 2006, 04:17:50 pm
Thaks Nibbler, album creation works now!

But I still can't select a user gallery from batch add or move files that are allready on the server to a user gallery?

I hate to be a pain in the ass but I'd really appreciate some help... :)
Title: Re: Admin upload pics to user's galery
Post by: serge on May 25, 2006, 12:03:25 am
Are you asking a question whether this works with bridged cpg or not? Or are you telling us that this works with cpg?

yes, this is a question.
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on May 25, 2006, 07:18:58 am
and the answer is given by Nibbler above...
Title: Re: Admin upload pics to user's galery
Post by: josephl on June 19, 2006, 10:05:21 pm
Greetings,

I'd really like to use the "batch-add" functionality to add photos to my users' albums.  For instance, if a user ships me a CD full of images, half of which should go into one album, and the other half of which should go into another album, the "batch-add" screen would be a great place to do that from.

My situation is that I'm selectively importing thousands of photos from hundreds of directories created by another gallery software (an ancient version of albinator).  When I was implimenting Coppermine, I didn't have the time to run the ablinator -> coppermine converter script.  I think that using the "batch-add" utility to convert these old albums to coppermine format will provide me the best results.

If you have alternate suggestions, I'd love to hear them.
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on June 20, 2006, 07:29:55 am
This thread is basically for uploading to user's album using http upload method. Please start a new thread for batch add.
Title: Re: Admin upload pics to user's galery
Post by: jans on October 24, 2006, 12:10:07 am
This thread is basically for uploading to user's album using http upload method. Please start a new thread for batch add.

JosephL did not decide to start a new thread, I believe. However it seems, that I managed to hack coppermine, so that admin can batch-upload users' files:

In a file ./bridge/udb_base.inc.php a change is required in a function get_batch_add_album_list, which seems to be used for batch upload only.

Instead of:

Code: [Select]
        function get_admin_album_list()
        {
                global $CONFIG;

                if ($this->can_join_tables) {
                        $sql = "SELECT aid, CONCAT('(', {$this->field['username']}, ') ', a.title) AS title
                                                        FROM {$CONFIG['TABLE_ALBUMS']} AS a
                                                        INNER JOIN {$this->usertable} AS u
                                                        ON category = (" . FIRST_USER_CAT . " + {$this->field['user_id']})
                                                        ORDER BY title";
                } else {
                        $sql = "SELECT aid, IF(category > " . FIRST_USER_CAT . ", CONCAT('* ', title), CONCAT(' ', title)) AS title " . "FROM {$CONFIG['TABL
E_ALBUMS']} " . "ORDER BY title";
                }
                return $sql;
        }

at about line 618, it now says:

Code: [Select]
        function get_batch_add_album_list()
        {
                global $CONFIG;
                if ($this->can_join_tables) {
                        $sql = "SELECT aid, CONCAT('(', u.user_name, ') ', a.title) AS title
                                                        FROM {$CONFIG['TABLE_ALBUMS']} AS a
                                                        INNER JOIN {$this->usertable} AS u
                                                        ON category = (" . FIRST_USER_CAT . " + u.user_id)";
                } else {
                        $sql = "SELECT aid, IF(category > " . FIRST_USER_CAT . ", CONCAT('* ', title), CONCAT(' ', title)) AS title " . "FROM {$CONFIG['TABL
E_ALBUMS']} WHERE category = ".(FIRST_USER_CAT+USER_ID)." ORDER BY title";
                }
                return $sql;
        }

Please note the change of a users' name displayed in parantheses (u.user_name) and a condition binding tables, which now allows inclusion of all users' albums. I did not change the else clause though, as haven't read the code deeply enought to find out, when is it actually used.

Have a good day,

(js).
Title: Re: Admin upload pics to user's galery
Post by: tutone on November 10, 2006, 05:13:05 pm
Jans -

I tried this and that didn't work... any ideas...
Title: Re: Admin upload pics to user's galery
Post by: hyperionx on November 29, 2006, 02:50:59 pm
this works great, thank you very much.

I was wondering though, would it be possible to edit so that i can move pictures to user's gallery with the "change file information"-function?
I guessing that it wouldnt be that much to change right? Any ideas? :)
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on November 30, 2006, 10:57:04 am
Are you talking about mod by jans or me?
Title: Re: Admin upload pics to user's galery
Post by: hyperionx on November 30, 2006, 02:11:52 pm
hmm, who is janz?
Im talking about the mod on the first page in this thread.
There is astandard feature in coppermine where you can move pics from one album to another. And i was thinking that the code couldnt be much different if i wanted to change that so i could move files to users personal galleries?
Title: Re: Admin upload pics to user's galery
Post by: Abbas Ali on December 05, 2006, 01:30:19 pm
For moving file to user albums you will need to edit editpics.php and editoOnePic.php I think it is doable.
Title: Re: Admin upload pics to user's galery
Post by: CartOps on February 09, 2007, 03:42:48 pm
I want to be able to do the exact opposite... I want users to be able to upload to admin albums. The idea is that I choose the album names (disable album creation for users) and have users only be able to upload to my albums. I tried changing upload.php to:
Code: [Select]
if (USER_ID) {
   $public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " ORDER BY title");
} else {
$public_albums = cpg_db_query("SELECT aid, title FROM {$CONFIG['TABLE_ALBUMS']} WHERE category < " . FIRST_USER_CAT . " AND uploads='YES' AND (visibility = '0' OR visibility IN ".USER_GROUP_SET.") ORDER BY title");
}
if (mysql_num_rows($public_albums)) {
    $public_albums_list = cpg_db_fetch_rowset($public_albums);
} else {
    $public_albums_list = array();
}
But it didn't work... almost though... but then I get an error saying "Selected pod does not exist or you don't have permission to upload in this pod " any help would be greatly appreciated... I know this is an old thread.
Title: Re: Admin upload pics to user's galery
Post by: CartOps on February 10, 2007, 03:47:21 am
Forget it... I got it. ;D
Title: Re: Admin upload pics to user's galery
Post by: Eddy Matthews on January 19, 2008, 07:03:47 pm
Does this mod work with Coppermine 1.4.14?

I've tried making the changes listed, and I can view all the users in my database, but the users gallery is not created....

Can anyone help please?

Regards
Eddy
Title: Re: Admin upload pics to user's galery
Post by: Eddy Matthews on January 19, 2008, 10:49:53 pm
Anyone???

I'm transfering from phpBB and FAP, so I need to be able to recreate all the user galleries and move the photos across - ANY help would be appreciated!

Regards
Eddy
Title: Re: Admin upload pics to user's galery
Post by: Eddy Matthews on January 20, 2008, 07:17:18 pm
Is anyone alive here?  :-\

Eddy
Title: Re: Admin upload pics to user's galery
Post by: Joachim Müller on January 21, 2008, 09:01:00 am
Does this mod work with Coppermine 1.4.14?
It should.

I've tried making the changes listed, and I can view all the users in my database, but the users gallery is not created....
Well, maybe you made an implementation mistake, maybe the mod doesn't work for cpg1.4.14 (which I doubt). Anyway, as you have failed to post a link to your gallery and a non-admin test user account, there's little we could do to help you. If you want help, you'll have to supply the needed information to enable supporters to look into your issues.

I'm transfering from phpBB and FAP, so I need to be able to recreate all the user galleries and move the photos across - ANY help would be appreciated!
I have no idea what "FAP" is, so what should I have replied? There is no point in posting "what the * are you talking about", so I haven't. Seems like all other supporters had the same thoughts, that's why nobody replied.

Is anyone alive here?  :-\
Yes. As suggested above: supply details if you want help. Just posting that something doesn't work as expected without providing details will not help at all. You might want to zip your changed files and attach them to your posting.
Title: Re: Admin upload pics to user's galery
Post by: Eddy Matthews on January 21, 2008, 09:20:35 am
My apologies Joachim, I've obviously got off to a bad start, so I'm sorry....

Attached are the two files I've modified - The changes allow me to view a listing of usernames when I attempt to create a user gallery, but when I select on no gallery is created. The changes to upload.php don;t seem to have any effect at all, and it works exactly as it did in the standard coppermine, but that's probably because I'm unable to create a user gallery to upload to?

Regards
Eddy
Title: Re: Admin upload pics to user's galery
Post by: Joachim Müller on January 21, 2008, 09:30:47 am
Anyway, as you have failed to post a link to your gallery and a non-admin test user account, there's little we could do to help you. If you want help, you'll have to supply the needed information to enable supporters to look into your issues.
Where's the link and test user account?
Title: problem with mod
Post by: Halfhidden on March 08, 2008, 10:11:51 pm
Ok. I still have problems since installing the mod (http://forum.coppermine-gallery.net/index.php/topic,26386.0.html).
The mod works well and enables me to upload to private users galleries if they either cannot or will not.
The problem I have now is as follows:
If I upload to a users album, the picture appears in that album. If later on either the album owner or admin edit any text in the properties of the picture (for instance the title name or description) when you go to apply changes the image is moved to a main gallery album. On closer inspection it seems that the private album isn't listed in the albums available for that picture any more, only the main gallery albums are available.
Now that means the picture is stuck in one of the main gallery albums and the only option I have is to move it around the main gallery or delete the image and upload it again.
Regards,
Steff
Title: Re: Admin upload pics to user's galery
Post by: Furvy on April 09, 2008, 05:01:36 am
this works great, thank you very much.

I was wondering though, would it be possible to edit so that i can move pictures to user's gallery with the "change file information"-function?
I guessing that it wouldnt be that much to change right? Any ideas? :)
For moving file to user albums you will need to edit editpics.php and editoOnePic.php I think it is doable.

I too, want to be able to move existing pictures in an existing album to a user's album, and change the picture owner to the user so that the user can modify their own files. Please help! It's tedious having to do this through phpmyadmin all the time :'(