Page with all user albums (read please) Page with all user albums (read please)
 

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

Page with all user albums (read please)

Started by kimweltz, June 18, 2007, 12:04:57 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

kimweltz

Hi,

I used 3 hours and 30 minutes trying to find a answer, but I did not succed  :-\  If the question has already been answered before, please just post the link.

I want to browse all useralbums on one page (ofcause with paging), so I dont have to click on every single username to get to their uploaded albums.

Hope someone can help me. Thanks alot.

Kim

Abbas Ali

Afaik there's no such mod/hack which will do what you need. Either you or someone else will have to code it.
Chief Geek at Ranium Systems

kimweltz

"Unfortunately" im a ASP coder, so I dont have the knowledge. But would I be able to find the insert section in the code when a user creates an album, and just change the category ID, to "root" id? Then all uploaded albums would fall under root, and I can display them without having to go throuh the username.

Abbas Ali

That would show the albums under the root category but many other things will break. User will not be able to upload pic to that album since it will belong to admin. Admin will have to manually make that album public. But then all users of that group will be able to upload to that album. So in short just changing the cat id is not a good solution.

A better approach will be something like creating altogether a new page to show all user albums. That page will basically be a duplicate of 'User gallery' page with one difference in select query. Instead of selecting albums only for one category, select albums of all categories.
Chief Geek at Ranium Systems

kimweltz

yeah, I had that idea too, and it sounds like that would be the best thing, but I have loocked into the index.php, and there are so many querys, that I get confused :(

Any idea witch line I have to edit?

Abbas Ali

Ok, edit index.php

In function list_albums()

Replace


$result = cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category = '$cat'" . $album_filter);


with


if ($cat == 1) {
$result = cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category > '".FIRST_USER_CAT."'" . $album_filter);
} else {
$result = cpg_db_query("SELECT count(*) FROM {$CONFIG['TABLE_ALBUMS']} as a WHERE category = '$cat'" . $album_filter);
}


and Replace


$sql = 'SELECT a.aid, a.title, a.description, category, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category=' . $cat . $album_filter . ' ORDER BY a.pos ' . $limit;


with


if ($cat == 1) {
$sql = 'SELECT a.aid, a.title, a.description, category, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category>' . FIRST_USER_CAT . $album_filter . ' ORDER BY a.pos ' . $limit;
} else {
$sql = 'SELECT a.aid, a.title, a.description, category, visibility, filepath, ' . 'filename, url_prefix, pwidth, pheight ' . 'FROM ' . $CONFIG['TABLE_ALBUMS'] . ' as a ' . 'LEFT JOIN ' . $CONFIG['TABLE_PICTURES'] . ' as p ' . 'ON a.thumb=p.pid ' . 'WHERE category=' . $cat . $album_filter . ' ORDER BY a.pos ' . $limit;
}


And then find


                    case 'catlist':
                        if ($breadcrumb != '' || count($cat_data) > 0) theme_display_cat_list($breadcrumb, $cat_data, $statistics);
                        if (isset($cat) && $cat == USER_GAL_CAT) {
                            list_users();
                        }
                        flush();
                        break;


and comment out the call to list_users()

That should do the trick and whenver someone see "User galleries" they will be presented with all albums belonging to users.
Chief Geek at Ranium Systems

kimweltz

Wow! Thank you for taking the time to help me. Its works absolutly as I wanted it to  :D

Joachim Müller

Not a valid feature request. Moving to support board.