aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2006-03-15 02:26:25 +0000
committerrvelices <rv-github@modusoptimus.com>2006-03-15 02:26:25 +0000
commit88e3b36e2f805404e0bfd56d865e317495e9c973 (patch)
tree042d17038fedbc588e7b839aa754461e41fcc4f4 /include/functions_user.inc.php
parent1d22950cf6391f1037be9cd35288b36d62ea6fe5 (diff)
feature 262: new user cached information nb_total_pictures
git-svn-id: http://piwigo.org/svn/trunk@1081 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions_user.inc.php')
-rw-r--r--include/functions_user.inc.php12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index ea2cfbfbe..44f1a1cf7 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -188,6 +188,13 @@ SELECT ui.*, uc.*
$userdata['forbidden_categories'] =
calculate_permissions($userdata['id'], $userdata['status']);
+ $query = '
+SELECT COUNT(DISTINCT(image_id)) as total
+ FROM '.IMAGE_CATEGORY_TABLE.'
+ WHERE category_id NOT IN ('.$userdata['forbidden_categories'].')
+;';
+ list($userdata['nb_total_images']) = mysql_fetch_array(pwg_query($query));
+
// update user cache
$query = '
DELETE FROM '.USER_CACHE_TABLE.'
@@ -197,9 +204,10 @@ DELETE FROM '.USER_CACHE_TABLE.'
$query = '
INSERT INTO '.USER_CACHE_TABLE.'
- (user_id,need_update,forbidden_categories)
+ (user_id,need_update,forbidden_categories,nb_total_images)
VALUES
- ('.$userdata['id'].',\'false\',\''.$userdata['forbidden_categories'].'\')
+ ('.$userdata['id'].',\'false\',\''
+ .$userdata['forbidden_categories'].'\','.$userdata['nb_total_images'].')
;';
pwg_query($query);
}