aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-11 12:53:04 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-03-11 12:53:04 +0000
commitb5d489b4ce30472f974fdb794cfea77a624c7bee (patch)
tree55d7466acf095d092f2ccdd6496b4bc405bfe067 /engine/lib
parent09d3b786dedc3b4a4e2eeda6e47488eda199b794 (diff)
downloadelgg-b5d489b4ce30472f974fdb794cfea77a624c7bee.tar.gz
elgg-b5d489b4ce30472f974fdb794cfea77a624c7bee.tar.bz2
user_info() ftw
git-svn-id: https://code.elgg.org/elgg/trunk@162 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/users.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/engine/lib/users.php b/engine/lib/users.php
index 7a0de2af0..0130da549 100644
--- a/engine/lib/users.php
+++ b/engine/lib/users.php
@@ -356,6 +356,35 @@
}
/**
+ * Get a particular piece of user info
+ * @param string $fieldname The name of the field we want to get
+ * @param int $user_id The id of the user we're checking for
+ * @return The value we seek, or false if the user doesn't exist
+ */
+ function user_info($fieldname, $user_id) {
+
+ // Name table
+ static $id_to_name_table;
+
+ // Returns field from a given ID
+
+ $user_id = (int) $user_id;
+
+ if (!empty($user_id)) {
+ if (!isset($id_to_name_table[$user_id][$fieldname])) {
+ $id_to_name_table[$user_id] = (array) get_data_row("select * from users where id = {$user_id}"); // get_record('users','ident',$user_id);
+ }
+ if (isset($id_to_name_table[$user_id][$fieldname])) {
+ return $id_to_name_table[$user_id][$fieldname];
+ }
+ }
+
+ // If we've got here, the user didn't exist in the database
+ return false;
+
+ }
+
+ /**
* Enter description here...
*
* @param unknown_type $criteria