aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions_user.inc.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-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;
+}
?>