aboutsummaryrefslogtreecommitdiffstats
path: root/admin/remote_site.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/remote_site.php')
-rw-r--r--admin/remote_site.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/admin/remote_site.php b/admin/remote_site.php
index 082658ab0..19db458b4 100644
--- a/admin/remote_site.php
+++ b/admin/remote_site.php
@@ -432,6 +432,21 @@ INSERT INTO '.IMAGE_CATEGORY_TABLE.'
$query.= '
;';
pwg_query($query);
+ // set a new representative element for this category
+ $query = '
+SELECT image_id
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ WHERE category_id = '.$category_id.'
+ ORDER BY RAND()
+ LIMIT 0,1
+;';
+ list($representative) = mysql_fetch_array(pwg_query($query));
+ $query = '
+UPDATE '.CATEGORIES_TABLE.'
+ SET representative_picture_id = '.$representative.'
+ WHERE id = '.$category_id.'
+;';
+ pwg_query($query);
}
}
// +-----------------------------------------------------------------------+