Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: Admin upload pics to user's galery  (Read 48187 times)

0 Members and 1 Guest are viewing this topic.

mumtaz

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Admin upload pics to user's galery
« 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.
« Last Edit: January 13, 2006, 04:00:25 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Admin upload pics to user's galery
« Reply #1 on: January 13, 2006, 07:01:45 am »

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

mumtaz

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Admin upload pics to user's galery
« Reply #2 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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Admin upload pics to user's galery
« Reply #3 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
Logged
Chief Geek at Ranium Systems

mumtaz

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: Admin upload pics to user's galery
« Reply #4 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. (http://forum.hwsw.hu/html/emoticons/ico_respect.gif)
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Admin upload pics to user's galery
« Reply #5 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.
Logged
Chief Geek at Ranium Systems

serge

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Admin upload pics to user's galery
« Reply #6 on: May 13, 2006, 12:57:31 pm »

works this with bridged cpg to smf
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Admin upload pics to user's galery
« Reply #7 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?
Logged
Chief Geek at Ranium Systems

Kyyhky

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Admin upload pics to user's galery
« Reply #8 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?  :)
Logged

Nibbler

  • Guest
Re: Admin upload pics to user's galery
« Reply #9 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";
Logged

Kyyhky

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Admin upload pics to user's galery
« Reply #10 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"

 ???

Logged

Nibbler

  • Guest
Re: Admin upload pics to user's galery
« Reply #11 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);
Logged

Kyyhky

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Admin upload pics to user's galery
« Reply #12 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... :)
Logged

serge

  • Coppermine newbie
  • Offline Offline
  • Posts: 3
Re: Admin upload pics to user's galery
« Reply #13 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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Admin upload pics to user's galery
« Reply #14 on: May 25, 2006, 07:18:58 am »

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

josephl

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: Admin upload pics to user's galery
« Reply #15 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.
Logged

Abbas Ali

  • Administrator
  • Coppermine addict
  • *****
  • Country: in
  • Offline Offline
  • Gender: Male
  • Posts: 2165
  • Spread the PHP Web
    • Ranium Systems
Re: Admin upload pics to user's galery
« Reply #16 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.
Logged
Chief Geek at Ranium Systems

jans

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 2
Re: Admin upload pics to user's galery
« Reply #17 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).
Logged
--
Regrads,

(js).

tutone

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 64
Re: Admin upload pics to user's galery
« Reply #18 on: November 10, 2006, 05:13:05 pm »

Jans -

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

hyperionx

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: Admin upload pics to user's galery
« Reply #19 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? :)
Logged
Pages: [1] 2   Go Up
 

Page created in 0.027 seconds with 19 queries.