Changeset 9365


Ignore:
Timestamp:
Feb 24, 2011, 12:30:30 PM (13 years ago)
Author:
plg
Message:

bug 937: problem on empty albums (visible for admins) with a representative_picture_id defined.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_cats.inc.php

    r9116 r9365  
    206206        if ($row['id'] == $category['representative_picture_id'])
    207207        {
    208           if ($category['count_images']>0)
     208          // searching a random representant among elements in sub-categories
     209          $image_id = get_random_image_in_category($category);
     210
     211          if (isset($image_id) and !in_array($image_id, $image_ids))
    209212          {
    210             // searching a random representant among elements in sub-categories
    211             $image_id = get_random_image_in_category($category);
    212 
    213             if (isset($image_id))
    214             {
    215               if (!in_array($image_id, $image_ids))
    216               {
    217                 array_push($new_image_ids, $image_id);
    218               }
    219              
    220               $user_representative_updates_for[ $user['id'].'#'.$category['id'] ] = $image_id;
    221 
    222               $category['representative_picture_id'] = $image_id;
    223             }
     213            array_push($new_image_ids, $image_id);
    224214          }
     215           
     216          $user_representative_updates_for[ $user['id'].'#'.$category['id'] ] = $image_id;
     217         
     218          $category['representative_picture_id'] = $image_id;
    225219        }
    226220      }
     
    288282  foreach ($categories as $category)
    289283  {
     284    if (0 == $category['count_images'])
     285    {
     286      continue;
     287    }
     288   
    290289    $category['name'] = trigger_event(
    291290        'render_category_name',
Note: See TracChangeset for help on using the changeset viewer.