aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2005-01-19 23:34:42 +0000
committerplegall <plg@piwigo.org>2005-01-19 23:34:42 +0000
commit54e615890c434d09492c6ba0c623b23bbcc8d246 (patch)
tree09078da371c3b2c5f80fd12a5aa437f65a1c41db /include
parentf760cdb9879ef3eafc0ec88c094c43a81b66e2bc (diff)
- bug fixed : in admin, username displayed in titles if needed even if only
user id was transmitted git-svn-id: http://piwigo.org/svn/trunk@708 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include')
-rw-r--r--include/functions_user.inc.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/functions_user.inc.php b/include/functions_user.inc.php
index 344231577..999ef95af 100644
--- a/include/functions_user.inc.php
+++ b/include/functions_user.inc.php
@@ -353,4 +353,30 @@ INSERT INTO '.USER_FORBIDDEN_TABLE.'
return $forbidden_categories;
}
+
+/**
+ * returns the username corresponding to the given user identifier if exists
+ *
+ * @param int user_id
+ * @return mixed
+ */
+function get_username($user_id)
+{
+ $query = '
+SELECT username
+ FROM '.USERS_TABLE.'
+ WHERE id = '.intval($user_id).'
+;';
+ $result = pwg_query($query);
+ if (mysql_num_rows($result) > 0)
+ {
+ list($username) = mysql_fetch_row($result);
+ }
+ else
+ {
+ return false;
+ }
+
+ return $username;
+}
?>