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]   Go Down

Author Topic: Meta albums - specifying a category?  (Read 3894 times)

0 Members and 1 Guest are viewing this topic.

Steve-R

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Meta albums - specifying a category?
« on: November 11, 2007, 02:55:05 pm »

I want to specify only one of the two categories from my gallery in the meta album "Top Rated" here is the function from functions.inc.php What would I need to change or add to achieve this? The catergory is cid1

Code: [Select]
                case 'toprated': // Top rated pictures

if (GALLERY_ADMIN_MODE){
                if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['toprated'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['toprated'];
                }
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >=

'{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND votes >=

'{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY (pic_rating * votes) DESC, votes DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('pic_rating'));

                $rowset = CPGPluginAPI::filter('thumb_caption_toprated',$rowset);

                return $rowset;
                break;

}else{

if ($META_ALBUM_SET && $CURRENT_CAT_NAME) {
                        $album_name = $lang_meta_album_names['toprated'].' - '. $CURRENT_CAT_NAME;
                } else {
                        $album_name = $lang_meta_album_names['toprated'];
                }
                $query = "SELECT COUNT(*) from {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND (aid < '2' OR aid > '2') AND

votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET";
                $result = cpg_db_query($query);
                $nbEnr = mysql_fetch_array($result);
                $count = $nbEnr[0];
                mysql_free_result($result);

                //if($select_columns != '*') $select_columns .= ', pic_rating, votes, aid, owner_id, owner_name';
                $select_columns = '*'; //allows building any data into any thumbnail caption

                $query = "SELECT $select_columns FROM {$CONFIG['TABLE_PICTURES']} WHERE approved = 'YES' AND (aid < '2' OR aid > '2')

AND votes >= '{$CONFIG['min_votes_for_rating']}' $META_ALBUM_SET ORDER BY (pic_rating * votes) DESC, votes DESC, pid DESC $limit";
                $result = cpg_db_query($query);
                $rowset = cpg_db_fetch_rowset($result);
                mysql_free_result($result);

                if ($set_caption) build_caption($rowset,array('pic_rating'));

                $rowset = CPGPluginAPI::filter('thumb_caption_toprated',$rowset);

                return $rowset;
                break;

}

Thanks in advance for any help

Steve
« Last Edit: November 15, 2007, 01:28:29 pm by Stramm »
Logged

Steve-R

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Meta albums - specifying a category?
« Reply #1 on: November 13, 2007, 07:09:14 pm »

Is this possible, can anyone shove me in the right direction?

Thanks in advance

Steve...:)
Logged

Steve-R

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Meta albums - specifying a category?
« Reply #2 on: November 14, 2007, 02:18:00 pm »

Am I not asking in the correct way? Is my question unclear? Can it not be done?

Its just its sat here (and so have I) for three days now and I wonder how it works exactly, do I need to clarify something/anything?

Regards

Steve...:)
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Logged

Steve-R

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Meta albums - specifying a category?
« Reply #4 on: November 15, 2007, 11:57:55 am »

Solved
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Meta albums - specifying a category?
« Reply #5 on: November 15, 2007, 01:28:20 pm »

It's always nice to 'really' solve the thread and not just write 'solved'.
Other may find your solution useful, too.

Steve-R

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 38
Re: Meta albums - specifying a category?
« Reply #6 on: November 15, 2007, 02:02:06 pm »

It's always nice to 'really' solve the thread and not just write 'solved'.
Other may find your solution useful, too.

I couldn't agree more, but after 3 days..and then given a lame support link..I decided it was solved..as in it cant be done I had after all asked nicely and provided the code I was attempting to change and this was (IMO) all that was needed for my question..I even asked to be pushed in the right direction to enable me to work it out for myself. I can specify categories or its equivalent on other php softwares (forum stuff) but could not seem to get it working here. However it is just a couple of lines of code as I'm sure you probably know.And now I'll go at it from another angle.

In all honesty and with the greatest respect to all I say the best solution (on this occasion) was not to ask the question in the first place. Thereby solving the subject.

Steve
Logged
Pages: [1]   Go Up
 

Page created in 0.025 seconds with 22 queries.