Skip to content

Instantly share code, notes, and snippets.

@popthestack
Created March 25, 2010 17:44
Show Gist options
  • Save popthestack/343876 to your computer and use it in GitHub Desktop.
Save popthestack/343876 to your computer and use it in GitHub Desktop.
<?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