Created
March 25, 2010 17:44
-
-
Save popthestack/343876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mytheme_get_user_profile($uid = NULL) { | |
if (empty($uid)) { | |
global $user; | |
$uid = $user->uid; | |
} | |
$result = db_query(" | |
SELECT f.fid AS f__fid, f.name AS f__name, f.title AS f__title, v.value AS v__value | |
FROM {profile_fields} AS f | |
LEFT JOIN {profile_values} AS v ON f.fid = v.fid | |
LEFT JOIN {users} AS u ON u.uid = v.uid | |
WHERE u.uid = %d", | |
$uid | |
); | |
$values = array(); | |
while ($field = db_fetch_object($result)) { | |
$values[$field->f__name] = array( | |
'title' => $field->f__title, | |
'value' => $field->v__value, | |
); | |
} | |
return $values; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment