Admin upload pics to user's galery Admin upload pics to user's galery
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Admin upload pics to user's galery

Started by mumtaz, January 12, 2006, 11:14:12 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

mumtaz

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.

Joachim Müller

that would defeat the point of a personal gallery,don't you think?

mumtaz

Quote from: GauGau on January 13, 2006, 07:01:45 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.

Abbas Ali

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


    $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)


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


then edit upload.php

Replace(Around line 850)


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


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
Chief Geek at Ranium Systems

mumtaz

Quote from: 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


    $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)


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


then edit upload.php

Replace(Around line 850)


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


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://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fforum.hwsw.hu%2Fhtml%2Femoticons%2Fico_respect.gif&hash=01250004b4f9ebced3871e95ff098a7bca4f60fa)

Abbas Ali

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.
Chief Geek at Ranium Systems

serge


Abbas Ali

Are you asking a question whether this works with bridged cpg or not? Or are you telling us that this works with cpg?
Chief Geek at Ranium Systems

Kyyhky

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?  :)

Nibbler

Change

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

to

$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";

Kyyhky

"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"

???


Nibbler

Also

$result1 = cpg_db_query($query);

to

$result1 = cpg_db_query($query, $cpg_udb->link_id);

Kyyhky

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... :)

serge

Quote from: 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?

yes, this is a question.

Abbas Ali

and the answer is given by Nibbler above...
Chief Geek at Ranium Systems

josephl

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.

Abbas Ali

This thread is basically for uploading to user's album using http upload method. Please start a new thread for batch add.
Chief Geek at Ranium Systems

jans

Quote from: 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.

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:


        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:


        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).
--
Regrads,

(js).

tutone

Jans -

I tried this and that didn't work... any ideas...

hyperionx

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? :)