From ea10c19ac5a1f6e89627497e5a6bfdefa37b5053 Mon Sep 17 00:00:00 2001 From: rvelices Date: Sun, 24 Mar 2013 06:46:35 +0000 Subject: feature 2836: display the number of comments/tags in the menubar git-svn-id: http://piwigo.org/svn/trunk@21817 68402e56-0260-453c-a942-63ccdbb3a9ee --- include/functions_tag.inc.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/functions_tag.inc.php') diff --git a/include/functions_tag.inc.php b/include/functions_tag.inc.php index 5766b9509..17ae996ab 100644 --- a/include/functions_tag.inc.php +++ b/include/functions_tag.inc.php @@ -22,6 +22,21 @@ // +-----------------------------------------------------------------------+ +/** returns the number of available tags for the connected user */ +function get_nb_available_tags() +{ + global $user; + if (!isset($user['nb_available_tags'])) + { + $user['nb_available_tags'] = count(get_available_tags()); + single_update(USER_CACHE_TABLE, + array('nb_available_tags'=>$user['nb_available_tags']), + array('user_id'=>$user['id']) + ); + } + return $user['nb_available_tags']; +} + /** * Tags available. Each return tag is represented as an array with its id, * its name, its weight (count), its url name. Tags are not sorted. -- cgit v1.2.3