This is what I came up with, but it's throwing an error. Anyone see any obvious errors? I can run the SQL query in PhpMyAdmin without getting an error but the Before Form piece doesn't like something.
$this->execPieceByName('ff_InitLib');
global $database, $record, $my;
$id = $my->email;
$database->setQuery("
SELECT a.userid as `UserID`,
u.name as `Name`,
u.email as `Email`,
u.registerDate as `Register`,
u.lastvisitDate as `LastVisit`,
u.activation as `Activated`,
a.status as `Status`,
a.points as `Points`,
a.friendcount as `FriendCount`,
MAX(IF(b.field_id=4,b.value, NULL)) AS 'Hometown',
MAX(IF(b.field_id=8,b.value, NULL)) AS 'LandPhone',
MAX(IF(b.field_id=9,b.value, NULL)) AS 'Address'
FROM jos_community_users a
LEFT JOIN jos_community_fields_values b ON a.userid = b.user_id
LEFT JOIN jos_community_fields f ON f.id = b.field_id
LEFT JOIN jos_users u ON u.id = a.userid
WHERE u.email = '$id'
GROUP BY a.userid
ORDER BY u.name, a.userid"
);
$row = $database->loadObjectList();
$record = $row[0];